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.
Nama | HP | |
---|---|---|
goncang | goncang@gmail.com | 081357579420 |
samudera | samudera@gmail.com | 081357579420 |
nasution | nasution@gmail.com | 081357579420 |
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>
)
}
The main table component that wraps all subcomponents.
Prop | Type | Description |
---|---|---|
children | ReactNode | Elements to be rendered inside the table. |
variant | "default" | "zebra" | "bordered" | Determines the style of the table. |
size | "default" | "normal" | Defines the table size. |
className | string | Additional classes for styling. |
Defines a table row.
Prop | Type | Description |
---|---|---|
children | ReactNode | Content to be displayed inside the row. |
className | string | Additional classes for styling. |
Defines a table header cell.
Prop | Type | Description |
---|---|---|
children | ReactNode | Content to be displayed inside the header cell. |
className | string | Additional classes for styling. |
Defines a table data cell.
Prop | Type | Description |
---|---|---|
children | ReactNode | Content to be displayed inside the cell. |
className | string | Additional classes for styling. |
Defines the body section of the table.
Prop | Type | Description |
---|---|---|
children | ReactNode | Rows to be displayed inside the table body. |
className | string | Additional classes for styling. |
Defines the header section of the table.
Prop | Type | Description |
---|---|---|
children | ReactNode | Rows to be displayed inside the table header. |
className | string | Additional classes for styling. |