Overview
Select multiple items from a list.Import
Usage
Live Preview
Run Locally
npm run tsx:core-gallery
Props
- options: string[] — Options list.
- selectedIndices?: number[] — Preselected indices.
- maxSelections?: number — Max number of selections.
- allowDeselect?: boolean — If false, selected items cannot be deselected.
- onChange?: (indices: number[], values: string[]) => void — Fires on change.
- BaseProps: container and list styling.
Methods
- setOptions(options), addOption(option), removeOption(index).
- setSelectedIndices(indices), getSelectedIndices(), getSelectedValues().
- selectAll(), deselectAll(), toggleSelection(index), isSelected(index), getSelectionCount().
Keyboard
- Up/Down: move pointer; Enter: toggle selection.
Installation
Import
Quick Start
Production Examples
Best Practices
- Mantieni l’altezza list limitata (6–10) con scroll per evitare overflow.
