Row selection
enableRowSelection adds a checkbox column and a select all checkbox. Selection survives sorting and filtering.
enableMultiRowSelection={false} allows one row at a time.
<ShadcnHeadlessTable {columns} {data} enableRowSelection getRowId={(row) => row.id} onSelectionChange={(rows) => (selected = rows)}/>- Without
getRowIda row’s id is its index indata, so ids change when the data does. table.selectedRowshas the selected items,table.toggleRow(id)andtable.toggleAllRows()change the selection.initialState={{ selectedRows: ['a', 'b'] }}starts with rows selected.onRowClickruns when a row is clicked.