Select
The Select component enhances user interaction by allowing the selection of a value or multiple values from a list of options. It’s designed with flexibility in mind, supporting a wide range of features such as:
- Single Select
- Multi Select
- Flexible customization of the components
- Tagging / Creation of options
- Filtering with Fuzzy Search via fuse.js
- Highlighting of selected options
- Async Support
- Groups Support
- Animation
Examples
Basic Usage
Single Select
A straightforward implementation for choosing a single option from a dropdown list:
- Custom Label
- Create value if not available
- Values with sections
- State: Error
- State: Full Width
Async
- Remote Fetch on Load
- Async Filtering
Multi-Select
Allows users to select multiple options, ideal for filtering mechanisms or gathering multiple interests/preferences.
Adornments
Render content before or after the input with the start and end props:
<Select start={<SearchIcon />} placeholder="Search a country..." options={options} />Theme Customization
The Select component adheres to a comprehensive theme, ensuring it seamlessly integrates into any application’s design:
- root{}(2 keys)
- Show all
The SelectInputTheme was restructured in 10.0.0:
interface SelectInputTheme {
base: string;
inputContainer: string;
input: string;
placeholder: string;
selectedValue: string; // was `prefix`
actions: { // was `suffix`
container: string;
button: string;
refresh: string;
close: string;
expand: string;
loader: string;
};
adornment: { // new
start: string;
end: string;
};
disabled: string;
unfilterable: string;
error: string;
single: {
selectedValue: string; // was `prefix`
inputContainer: string;
input: string;
};
multiple: {
selectedValue: string; // was `prefix`
inputContainer: string;
};
open: string;
chip: { /* ... */ };
}The
inputPrefixprop was also removed fromSelectOption.
Learn more about how to customize in the Theme documentation.
API
Configure the Select component to suit your application’s needs with these properties:
Select
SelectOption
SelectMenu
SelectInput
SelectInputChip
Design and Usability Tips
- Immediate Feedback: Provide visual cues for actions such as hovering, selection, and focusing, enhancing the user’s interaction with the component.
- Keyboard Navigation: Support full keyboard navigation including arrow keys for option selection and Esc to close the dropdown, ensuring accessibility.