Usage
Hook that returns a TablePlugin which prepends a right-aligned, monospaced row-number column. Numbering follows the rendered data order (reflecting the current sort / filter / pagination view) and starts at 1 by default. Astryx renderCell receives only the row item, so the plugin takes the rendered data array to derive each ordinal.
tsimport {useTableRowIndex} from '@astryxdesign/core/Table'
Parameters
| Param | Type | Description |
|---|---|---|
datarequired | T[] | The data array currently rendered by the table (post sort/filter/page). Numbering follows this order. |
getRowKey | (item: T) => string | Optional key extractor returning a unique string per row. When provided, index lookup is keyed by the returned string; otherwise items are matched by reference identity. Memoize with useCallback for a stable plugin identity. |
label | ReactNode (default: '#') | Header label for the index column. |
startFrom | number (default: 1) | First index value. |
Examples
Common configurations, variations, and states.A table with a prepended row-number column via useTableRowIndex. Numbering is monospaced, right-aligned, and follows the rendered data order.