Data Table
Data · Avatar, Badge, DataTable, FilterBar
Table with the features list pages need: sorting, row selection with a bulk action bar, column toggles, sticky header and expandable rows. FilterBar sits above it.
DataTable props: columns ({key, label, render, align, sortable, sortValue(row), hideable, hidden, width}), rows, rowKey ("id"), selectable, bulkActions ({label, icon, danger, onClick(rows, clear)}), renderExpanded(row), stickyHeader, maxHeight, defaultSort ({key, dir}), toolbar, columnToggle (false hides), empty.
FilterBar props: filters ({key, label, icon, options}), value / onChange ({key: option}), search (placeholder), query / onQuery, right.
- Sort cycles ascending → descending → off; the arrow only shows on the sorted or hovered column.
- The bulk bar floats at the bottom of the table while rows are selected; destructive actions are red and go through an Undo toast or ConfirmDialog.
- Active filters are ink chips you can click to change or × to remove. "Clear all" appears from two filters on.
- The header checkbox shows a dash when some, not all, rows are selected.
- Put it in
tf-panel tf-panel-flush so cells line up at 24px with other panels.
Props
Avatar
| Prop | Type | Notes |
|---|
name | string | Required |
src? | string | |
size? | number | |
tint? | Tint | "surface-sunken" | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
Badge
| Prop | Type | Notes |
|---|
tone? | Tone | |
dot? | boolean | |
live? | boolean | |
children? | ReactNode | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
DataTable
| Prop | Type | Notes |
|---|
columns | DataColumn<R>[] | Required |
rows | R[] | Required |
rowKey? | string | |
selectable? | boolean | |
bulkActions? | { label: string; icon?: IconName; danger?: boolean; onClick: (rows: R[], clear: () => void) => void; }[] | |
renderExpanded? | (row: R) => ReactNode | |
stickyHeader? | boolean | |
maxHeight? | number | string | |
defaultSort? | { key: string; dir: "asc" | "desc" } | |
toolbar? | ReactNode | |
columnToggle? | boolean | |
empty? | ReactNode | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
FilterBar
| Prop | Type | Notes |
|---|
filters | FilterDef[] | Required |
value | Record<string, string> | Required |
onChange | (v: Record<string, string>) => void | Required |
search? | string | |
query? | string | |
onQuery? | (q: string) => void | |
right? | ReactNode | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |