Skip to content

useTableSelectionState

@astryxdesign/core v0.7.1 · useTableSelectionState

Usage ​

State management companion for useTableSelection. Returns selectionConfig for the behaviour plugin plus selectionState for selection-aware UI such as TableSelectionToolbar. The selection itself stays controlled: you own the Set of selected keys and pass a setter. Select-all only takes the rows that can be checked, so rows that are not selectable or are disabled keep whatever state they had. idKey takes a property name or a function that returns the key.

ts
import { useTableSelectionState } from '@astryx-vue/core/Table'

Examples ​

useTableSelectionState — Row Selection

Name
Email
Role
Alicealice@example.comEngineer
Bobbob@example.comDesigner
Charliecharlie@example.comManager
Dianadiana@example.comEngineer
Eveeve@example.comAdmin

Table with row selection checkboxes and a select-all header checkbox. The checked keys and the setter stay in the caller, and selectionState mirrors them for selection-aware UI such as a toolbar.