Table

Description

The Table component is a flexible and customizable table for rendering tabular data. It supports variants, sizes, and styling via class-variance-authority. Composed of subcomponents (Table, Table.Header, Table.HeaderCell, Table.Cell, Table.Row, Table.Body), it ensures structured and styled tables.

Usage

NamaEmailHP
goncanggoncang@gmail.com081357579420
samuderasamudera@gmail.com081357579420
nasutionnasution@gmail.com081357579420

import { Table } from "mogora-ui";

export default function TableDemo() {
  return (
    <Table variant={"default"}>
      <Table.Header>
        <Table.HeaderRow>
          <Table.HeaderCell>Nama</Table.HeaderCell>
          <Table.HeaderCell>Email</Table.HeaderCell>
          <Table.HeaderCell>HP</Table.HeaderCell>
        </Table.HeaderRow>
      </Table.Header>
      <Table.Body>
        <Table.Row>
          <Table.Cell>goncang</Table.Cell>
          <Table.Cell>goncang@gmail.com</Table.Cell>
          <Table.Cell>085133212312</Table.Cell>
        </Table.Row>
        <Table.Row>
          <Table.Cell>samudera</Table.Cell>
          <Table.Cell>samudera@gmail.com</Table.Cell>
          <Table.Cell>081357579420</Table.Cell>
        </Table.Row>
        <Table.Row>
          <Table.Cell>nasution</Table.Cell>
          <Table.Cell>nasution@gmail.com</Table.Cell>
          <Table.Cell>082234223334</Table.Cell>
        </Table.Row>
      </Table.Body>
    </Table>
  )
}
Variants

API Reference

Table

The main table component that wraps all subcomponents.

PropTypeDescription
childrenReactNodeElements to be rendered inside the table.
variant"default" | "zebra" | "bordered"Determines the style of the table.
size"default" | "normal"Defines the table size.
classNamestringAdditional classes for styling.

Table.Row

Defines a table row.

PropTypeDescription
childrenReactNodeContent to be displayed inside the row.
classNamestringAdditional classes for styling.

Table.HeaderCell

Defines a table header cell.

PropTypeDescription
childrenReactNodeContent to be displayed inside the header cell.
classNamestringAdditional classes for styling.

Table.Cell

Defines a table data cell.

PropTypeDescription
childrenReactNodeContent to be displayed inside the cell.
classNamestringAdditional classes for styling.

Table.Body

Defines the body section of the table.

PropTypeDescription
childrenReactNodeRows to be displayed inside the table body.
classNamestringAdditional classes for styling.

Table.Header

Defines the header section of the table.

PropTypeDescription
childrenReactNodeRows to be displayed inside the table header.
classNamestringAdditional classes for styling.