Overview
Pick one option from a list.Import
Usage
Live Preview
Run Locally
npm run tsx:core-gallery
Props
- options: string[] — List items to select from.
- onSelect?: (index: number, value: string) => void — Fires on selection.
- placeholder?: string — Placeholder entry when nothing selected.
- selectedIndex?: number — Preselect index; -1 for none.
- searchable?: boolean — Enables inline search mode (
/to start,Escto exit). - maxHeight?: number — Constrains list height.
- BaseProps: position, variant, size, borderStyle, label, keys, mouse.
Methods
- setOptions(options), addOption(option), removeOption(index).
- setSelectedIndex(index), getSelectedIndex(), getSelectedValue().
- filterOptions(filter), clearFilter().
- setPlaceholder(text), setSearchable(bool), setMaxHeight(h).
Keyboard
- Up/Down: navigate options.
- Enter: select item.
/: enter search mode (if searchable);Esc: exit.
Installation
Import
Quick Start
Production Examples
Best Practices
- Usa
placeholderper indicare lo stato non selezionato; limita le opzioni visibili conmaxHeight.
