Table
Table gives dense records a scannable grid you compose from styled row and cell primitives.
| Member | Role | Status |
|---|---|---|
Aria Patel aria@acme.io | Owner | Active |
Diego Ramos diego@acme.io | Admin | Active |
Mei Lin mei@acme.io | Editor | Invited |
Sam Turner sam@acme.io | Viewer | Active |
Installation
Add this component with the NateUI CLI.
Examples
Basic
Compact
Bordered
Vertical Divider
Grouped Header
Sorting
Filtering
Row Selection
Pagination
Expandable Rows
TanStack Table
API
Table is a compound component: the default export is the styling wrapper, and
the section, row, and cell primitives hang off it as Table.THead,
Table.TBody, Table.TFoot, Table.Tr, Table.Th, Table.Td, and
Table.Sorter. Each primitive renders its matching native element and forwards
native props, so you own the data and behavior yourself.
Table
| Prop | Description | Type | Default |
|---|---|---|---|
bordered | Wrap the table or overflow renderer in a bordered card surface. | boolean | false |
compact | Reduce cell padding for dense data. | boolean | false |
hoverable | Highlight body rows on hover. | boolean | true |
overflow | Wrap the table in an overflow container. Uses the native overflow wrapper unless renderOverflow is supplied. | boolean | true |
overflowClass | Extra classes for the default overflow container. | string | - |
renderOverflow | Renders a custom overflow container around the table when overflow is enabled. The result is placed inside the bordered surface when bordered is enabled. | (table: ReactNode) => ReactNode | - |
verticalDivider | Show vertical column dividers per section. | TableVerticalDivider | { head: false, body: false, footer: false } |
asElement | Render the table as a different element, for example a flex layout. | ElementType | 'table' |
...nativeProps | Native table element props. | ComponentPropsWithRef<'table'> | - |
Table.THead / Table.TBody / Table.TFoot
| Prop | Description | Type | Default |
|---|---|---|---|
asElement | Render the section as a different element. | ElementType | 'thead' / 'tbody' / 'tfoot' |
...nativeProps | Native section element props. | ComponentPropsWithRef<'thead'> | - |
Table.Tr
| Prop | Description | Type | Default |
|---|---|---|---|
asElement | Render the row as a different element. | ElementType | 'tr' |
...nativeProps | Native tr props, including className for selected or active rows. | ComponentPropsWithRef<'tr'> | - |
Table.Th / Table.Td
| Prop | Description | Type | Default |
|---|---|---|---|
asElement | Render the cell as a different element. | ElementType | 'th' / 'td' |
...nativeProps | Native cell props, including colSpan, rowSpan, and className. | ComponentPropsWithRef<'th'> | - |
Table.Sorter
| Prop | Description | Type | Default |
|---|---|---|---|
sort | Current sort direction. true shows the neutral indicator; 'asc' and 'desc' show the active arrows. | boolean | 'asc' | 'desc' | - |
className | Extra classes for the sorter wrapper. | string | - |