Table
A native table that scrolls sideways on narrow screens.
Usage
tsx
<Table>
<Table.Head>
<Table.Row>
<Table.HeadCell>prop</Table.HeadCell>
<Table.HeadCell>type</Table.HeadCell>
<Table.HeadCell>default</Table.HeadCell>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>active</Table.Cell>
<Table.Cell>boolean</Table.Cell>
<Table.Cell>false</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>as</Table.Cell>
<Table.Cell>ElementType</Table.Cell>
<Table.Cell>"div"</Table.Cell>
</Table.Row>
</Table.Body>
</Table>| prop | type | default |
|---|---|---|
| active | boolean | false |
| as | ElementType | "div" |
Rows from data
tsx
<Table.Body>
<List
array={rows}
itemExtractor={({ row }) => (
<Table.Row key={row.id}>
<Table.Cell>{row.name}</Table.Cell>
</Table.Row>
)}
/>
</Table.Body>Long text
Cells don't wrap. Allow it on the columns that hold sentences.
tsx
<Table.Cell className="whitespace-normal">{row.description}</Table.Cell>Reference
Every part takes the same props.
| prop | type | default | |
|---|---|---|---|
as? | ElementType | — | the element or component to render; see the parts below |
className? | string | — | added after the component's own class: what you set wins |
…rest | props of as | — | typed against the chosen element |
| part | |
|---|---|
Table | table, inside a bordered div that scrolls sideways |
Table.Head | thead |
Table.Body | tbody |
Table.Row | tr |
Table.HeadCell | th |
Table.Cell | td |