Skip to content

Table

@astryxdesign/core v0.7.1 · Table

Props ​

Table ​

NameTypeDefaultDescription
dataT[]-Rows. When omitted, the default slot composes the table by hand.
columnsTableColumn<T>[]-key, header, width, align, verticalAlign, sortable, filter, and renderCell.
idKeystring | (row: T) => string'id'Row identity. Grouped rows need a function so the synthetic headers stay stable.
density'compact' | 'balanced' | 'spacious''balanced'Cell padding. Compact is 4×8, balanced is 8×12, spacious is 12×16.
dividers'rows' | 'columns' | 'grid' | 'none''rows'The header always keeps its bottom border. The last body row does not draw a row rule.
isStripedbooleanfalseEven body rows use the muted background.
hasHoverbooleanfalseHover fill, only when the pointer can hover.
verticalAlign'top' | 'middle' | 'bottom''middle'Default vertical alignment. A column can override it.
textOverflow'wrap' | 'truncate''wrap'Whether cell text wraps or clips to one line.
pluginsRecord<string, TablePlugin<T>>-Sort, selection, pagination, column settings, resize, filtering, groups, trees, expansion, sticky columns, row status, and row numbers.
labelstringlocalized “Table”Accessible name of the table.
rowIndexStartnumber1Where the first visible data row sits in the full result. Setting this or the total count numbers the data rows.
rowCountnumber-How many rows the full result has. With only a start index, the total is unknown.

useTableGroupedRows ​

NameTypeDefaultDescription
dataT[]requiredRows after filtering, sorting, and paging.
groupBy(item: T) => stringrequiredWhich section a row belongs to.
collapsedGroupsSet<string>requiredSections that are collapsed. Replace the set when it changes.
onToggleGroup(groupKey: string) => voidrequiredCalled from the header or its chevron.
renderGroupHeader(key, count, collapsed) => VNodeChildname and countContent to the right of the chevron.
getRowKey(item: T) => stringpositionStable identity for a real row.
groupOrderstring[]first seenKeys listed here come first.

useTableTreeState ​

NameTypeDefaultDescription
dataT[]requiredNested rows.
idKeystring | (item) => stringrequiredNode identity. It remembers expansion and skips a cycle.
childrenKeystringchildrenField that holds child rows.
expandedIdsSet<string>-Controlled expansion. Omit it and the state stays inside the composable.
defaultExpandedIdsIterable<string>emptyNodes open on the first render.
onExpandedIdsChange(ids) => void-Called when the open set changes.
hasExpandAllControlbooleanfalsePuts an expand-all button on the tree column header.
hasRowClickExpansionbooleanfalseA row click toggles a node that has children. Clicks on controls or a text selection do not.
indent'sm' | 'md' | 'lg'mdHow far each level steps in.
treeColumnKeystringfirst ordinary columnColumn that shows the indent and chevron.
sortSiblings(siblings: T[]) => T[]-Order for one level.

useTableRowExpansion ​

NameTypeDefaultDescription
expandedKeysSet<string>requiredRows that are open. The caller owns the set.
onToggle(key: string) => voidrequiredCalled from the chevron, a row click, or the context menu.
getRowKey(item: T) => stringrequiredRow identity.
renderExpanded(item: T) => VNodeChildrequiredDetail content. It lines up with the first column, past the chevron.
getIsItemExpandable(item: T) => booleanevery rowWhich rows can open.
panelVariant'muted' | 'transparent'transparentPanel surface. Transparent continues the table surface. Muted separates the detail from the data.
hasRowClickExpansionbooleanfalseA row click toggles the panel. Clicks on controls or a text selection do not.

useTableStickyColumns ​

NameTypeDefaultDescription
startKeysstring[]emptyPin from the first column through the last listed key.
endKeysstring[]emptyPin from the first listed key through the last column.

useTableRowStatus ​

getStatus returns null for an empty cell. A semantic status draws the success, warning, or error icon. A custom status takes a color: an icon when one is given, otherwise a dot. The label is in the tooltip and in the accessible name.

useTableRowIndex ​

data is the rows the table is painting, after grouping. startFrom begins at 1. getRowKey recognizes the same row; without it, identity is the object itself. label is the column header, and the default is a hash mark.

proportional(value) shares leftover width. Its default minimum is 120px. A column with no width is flexible with a 60px floor. pixel(value) sets both width and minimum width.

TableSelectionToolbar ​

count is the number of selected rows. The clear event asks the caller to drop the selection. The default slot is the bulk actions. The count, the clear label, and the region name come from the table messages.

Theming ​

Header text uses the label size, semibold weight, and the secondary text color. Body text uses the body size. A selected row uses the accent muted fill. Stripes use the muted background. Hover uses the hover overlay. Inside a card, the scroll area uses the card’s container padding so the first and last cells line up with the heading.