ComboBox
Autocomplete input combining text entry with dropdown selection and filtering.
Import
Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
options* | ComboBoxOption[] | — | Options to display in the dropdown |
value | string | — | Selected value (controlled) |
defaultValue | string | '' | Default selected value (uncontrolled) |
onValueChange | (value: string) => void | — | Callback when value changes |
placeholder | string | 'Search...' | Placeholder text |
label | string | — | Label text |
disabled | boolean | false | Whether the combobox is disabled |
className | string | — | Additional CSS class names |
ref | React.Ref<HTMLInputElement> | — | Forwarded ref to the input element |
ComboBoxOption Type
With Label
With Descriptions
Options can include descriptions that are also searchable:
States
Default Value
Controlled ComboBox
Value: (empty)
Interactive Example
Country: (none)
Framework: (none)
Long Option List
Works well with many options:
Features
- Autocomplete filtering: Type to filter options
- Highlight matching text: Matching portions are highlighted
- Keyboard navigation: Full keyboard support
- Descriptions: Optional description field for each option
- Click or type: Open dropdown by clicking arrow or typing
Keyboard Navigation
| Key | Action |
|---|---|
Arrow Down | Open dropdown / highlight next option |
Arrow Up | Highlight previous option |
Enter | Select highlighted option |
Escape | Close dropdown |
Tab | Close dropdown and move focus |
Accessibility
- Proper ARIA combobox attributes
- Screen reader support
- Full keyboard navigation
- Focus management
Styling
| Variable | Description |
|---|---|
--theme-border | Input and dropdown border |
--theme-background | Input and dropdown background |
--theme-text | Text color |
--theme-button | Highlighted option background |