Smart Select
LyteNyte Grid's smart select component is a versatile combobox that supports single and multiple selection and asynchronous loading.
The SmartSelect component is a hybrid, headless combobox and select component. The selection
list uses a single, unified list box, while the selection trigger can be either a select trigger
or a combobox trigger.
Single Select
The simplest variant of the SmartSelect component is the single select variant.
Set the kind property to "basic" and the trigger property to SmartSelect.BasicTrigger
to use the SmartSelect component in basic select mode.
The demo below demonstrates this configuration. The value and options properties are required.
Each SmartSelect option must have a unique ID.
Combo Select
Set the kind property to "combo" and the trigger property to SmartSelect.ComboTrigger to
use the SmartSelect component in combobox mode. A combobox allows users to search for an item
before selecting it.
The demo below shows the SmartSelect component used as a combobox. In this demo, the selected
value is used as the combobox input value, but this behavior is not required. In most cases,
a combobox is used to update the state of another component based on the selected value.
Multiple Select
Set the kind property to "multi" and the trigger property to SmartSelect.MultiTrigger to
use the SmartSelect component in multi-select mode. Multi-select mode allows users to select
multiple items.
The value property must be provided as an array of options, unlike the basic select variant,
which accepts a single selected value.
The demo below shows multi-select in action. Selected items are rendered as SmartSelect.Chip
components. You must use SmartSelect.Chip for selected values to ensure the SmartSelect
component correctly handles keyboard navigation.
Multiple Combobox
Set the kind property to "multi-combo" and the trigger property to
SmartSelect.MultiComboTrigger to use the SmartSelect component in multi-combobox mode.
Multi-combobox mode allows users to select multiple items using a combobox input.
The demo below shows multi-combobox in action. Selected items are rendered as
SmartSelect.Chip components. Users can type into the search input to add additional chips
to the current selection.
Asynchronous Select
When the SmartSelect component uses a combobox trigger, the options property can return a
Promise. Returning a Promise places the SmartSelect component into search mode.
The demo below shows asynchronous searching. This approach is useful when options for a given search query must be fetched from a server.
Properties
The SmartSelect component is composed of several headless component parts. This section
describes the properties for headless components that define behavior beyond standard HTML
element properties.
SmartSelect
Prop
Depending on the kind property, additional properties are available.
Basic
Prop
Multi Select
Prop
Combo Select
Prop
Multi-Combo Select
Prop
SmartSelect.Chip
Prop
SmartSelect.MultiTrigger
Prop
SmartSelect.MultiComboTrigger
Prop
SmartSelect.Option
Prop
Next Steps
- Menu Button: Display a list of actions or options in an accessible dropdown menu.
- Popover: Display additional content in a popover.
- Pill Manager: Create and manage grid interactions using label pills.
