tsimport {XDSTable} from '@xds/core/Table'
| Guidance | Practices |
|---|---|
| Do | Use density and divider variants to match the information density and scanning needs of your data. |
| Do | Compose rich cell content with XDS components like XDSBadge, XDSStatusDot, and XDSAvatar via renderCell. |
| Don't | Use a table for data without consistent columns — use a list or card layout for heterogeneous content. |
| Don't | Enable every plugin at once — add only the features your use case requires to keep the interface focused. |
| Prop | Type | Description |
|---|---|---|
data | T[] | Array of data items to render as rows. |
columns | XDSTableColumn<T>[] | Column definitions. If omitted, columns are auto-generated from data object keys. |
idKey | (keyof T & string) | ((item: T) => string | number) | Row key for React reconciliation. Pass a property name string or a function. Falls back to row index if omitted. |
plugins | TablePlugin<T>[] | Ordered array of plugins applied as a sequential transform pipeline. |
components | {Row?: ComponentType<TableRowComponentProps>; Cell?: ComponentType<TableCellComponentProps>; HeaderCell?: ComponentType<TableHeaderCellComponentProps>} | Component overrides for row and cell elements. When provided, these components receive xstyle from plugin transforms. |
children | ReactNode | Children mode — render rows directly in the tbody instead of using data-driven rendering. |
tableProps | HTMLAttributes<HTMLTableElement> | Additional HTML attributes passed directly to the root <table> element. |
| Prop | Type | Description |
|---|---|---|
data | T[] | Array of data items to render as rows. |
columns | XDSTableColumn<T>[] | Column definitions. If omitted, columns are auto-generated from data object keys. |
idKey | (keyof T & string) | ((item: T) => string | number) | Row key for React reconciliation. Pass a property name string or a function. Falls back to row index if omitted. |
density | 'compact' | 'balanced' | 'spacious' (default: 'balanced') | Row density controlling cell padding and font size. |
dividers | 'rows' | 'columns' | 'grid' | 'none' (default: 'rows') | Divider style rendered between cells. |
isStriped | boolean (default: false) | Applies a background wash to even-numbered rows. |
hasHover | boolean (default: false) | Applies a hover highlight background to rows on pointer devices. |
plugins | Record<string, TablePlugin<T>> | Named plugins that extend table behavior via the transform pipeline. Converted to an ordered array internally. |
children | ReactNode | Children mode — render XDSTableRow/XDSTableCell directly instead of using data-driven rendering. |
xstyle | StyleXStyles | StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value — not an inline style object like style={{}}. |
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Cell content. |
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Header cell content. |
| Prop | Type | Description |
|---|---|---|
childrenrequired | ReactNode | Row cell elements. |
| Prop | Type | Description |
|---|---|---|
columnsrequired | XDSColumnSettingsOption[] | All available columns with metadata for the settings UI. Each entry has key, label, optional isAlwaysVisible and group. |
activeColumnKeysrequired | string[] | Currently active column keys, in display order. Only columns with keys in this array are shown. |
onChangeActiveColumnKeysrequired | (keys: string[]) => void | Called when active columns change (toggle, reorder). |
defaultColumnKeys | string[] | Default column set for "Reset to default". When omitted, reset shows all columns. |
| Prop | Type | Description |
|---|---|---|
pagerequired | number | Current page number (1-based). |
onPageChangerequired | (page: number) => void | Called when the page changes. |
totalItems | number | Total number of items across all pages. Used to calculate total page count. |
totalPages | number | Total number of pages. Use when you know the page count but not item count. |
hasMore | boolean | Whether more pages exist. Use for cursor-based pagination where the total is unknown. |
pageSize | number (default: 10) | Number of items per page. |
onPageSizeChange | (pageSize: number) => void | Called when the user changes the page size. Shows a page size dropdown when provided with pageSizeOptions. |
pageSizeOptions | number[] | Available page size options. Shows a page size selector when provided. |
variant | 'pages' | 'count' | 'compact' | 'dots' | 'none' (default: 'pages') | Visual variant for the pagination controls. |
position | 'below' | 'above' | 'both' | 'none' (default: 'below') | Where to render pagination controls relative to the table. |
align | 'start' | 'center' | 'end' (default: 'center') | Horizontal alignment of the pagination controls. |
| Prop | Type | Description |
|---|---|---|
getIsItemSelectedrequired | (item: T) => boolean | Returns whether the given item is currently selected. |
onSelectItemrequired | (event: {item: T; isSelected: boolean}) => void | Called when a row checkbox is toggled. isSelected is the new desired state. |
onSelectAllrequired | (event: {isAllSelected: boolean}) => void | Called when the select-all header checkbox is toggled. |
getIsAllSelectedrequired | () => boolean | Returns whether all selectable items are currently selected. |
getIsIndeterminate | () => boolean | Returns whether selection is partial (some but not all). Renders the select-all checkbox in indeterminate state. |
getIsItemSelectable | (item: T) => boolean (default: () => true) | Returns whether a row should show a checkbox. Non-selectable rows render nothing in the selection cell. |
getIsItemEnabled | (item: T) => boolean (default: () => true) | Returns whether a row checkbox is interactive. Disabled rows show a disabled checkbox. |
| Prop | Type | Description |
|---|---|---|
datarequired | T[] | The full data array rendered in the table. |
idKeyrequired | (keyof T & string) | ((item: T) => string) | Key extractor — property name or function returning a unique string ID. |
selectedKeysrequired | Set<string> | Controlled set of selected item IDs. |
setSelectedKeysrequired | Dispatch<SetStateAction<Set<string>>> | Setter for the controlled selected keys. |
getIsItemSelectable | (item: T) => boolean (default: () => true) | Should this row show a checkbox? Non-selectable rows are excluded from select-all. |
getIsItemEnabled | (item: T) => boolean (default: () => true) | Is this row checkbox interactive? Disabled rows are frozen — select-all preserves their state. |
| Prop | Type | Description |
|---|---|---|
sortrequired | XDSTableSortState<TSortKey> | Current sort state. Ordered array of {sortKey, direction} entries. First entry is the primary sort. |
onSortChangerequired | (sort: XDSTableSortState<TSortKey>) => void | Called when the user clicks a header cell to change sort. |
allowUnsortedState | boolean (default: false) | Allow cycling back to unsorted. When true: asc, desc, unsorted. When false: asc, desc, asc. |
isMultiSortEnabled | boolean (default: false) | Enable multi-sort via Shift+click. Regular click still replaces the entire sort state. |