API and Development
Table displays structured data in a simple, semantic table format, providing full control over layout and styling without built-in data management features. It provides a lightweight, semantic table component built on Radix UI's Table primitives. It renders tabular data with proper HTML structure, supports flexible cell alignment and sizing, and offers complete control over rendering without any built-in data management features like sorting, filtering, or pagination. It's the foundation component that DataTable builds upon, ideal for simple displays, static content, or when you need complete control over table structure and styling.
Use Table (from @prepared911/ui) when you need:
DataTable (from @prepared911/ui/data-table) when you need: (see the Data table package API for generated props, Storybook links, and a live preview)
| Name | Type | Default | Description |
|---|---|---|---|
aria-description | LocalizedMessage | — | Extended description for assistive tech. |
aria-label | LocalizedMessage | — | Accessible name when the visible label is insufficient. |
aria-placeholder | LocalizedMessage | — | Hint for an empty control. |
children | ReactNode | — | Table content: {@link TableHeader } and {@link TableBody }. |
className | string | — | Classes appended after generated classes. Put overrides in @layer chroma.overrides. |
ref | Ref<HTMLTableElement> | — | Ref to the table. |
shrink | boolean | false | When true, columns size to their content (table-layout: auto). Otherwise the layout is fixed
and columns share the inline size equally unless a column sets its own. |
title | LocalizedMessage | — | Native tooltip; accessibility hint, not visible UI title text. |
| Name | Default | Description |
|---|---|---|
shrink | false | Whether to use auto layout (shrink) or fixed layout. When true, table uses auto layout; when false, uses fixed layout. |
children | required | Table structure components (TableHeader, TableBody, etc.). |
| Name | Default | Description |
|---|---|---|
type | TableCellType.Default | Cell type determining semantic meaning. Options: Default, ColumnHeader, RowHeader. |
justify | Text alignment within the cell. Options: Start, Center, End. | |
width | Fixed width for the cell (e.g., "20rem", "300px"). | |
minWidth | Minimum width for the cell. | |
maxWidth | Maximum width for the cell. | |
colSpan | Number of columns the cell spans. | |
children | required | Cell content. |
width prop.
Use auto layout to let content determine column widths.