Getting Started
Foundations
Components
Search for a command to run...
ComboBox provides an autocomplete or command palette interface where users can type to filter and search through options. It's ideal for selecting from large lists where scrolling would be impractical. The component combines the functionality of a text input with a dropdown menu, offering type-ahead search and keyboard navigation.
Registry Component: This component is available from the Strongtie
registry. Add it using: npx shadcn@latest add @strongtie/combobox
Add this component from the Strongtie registry:
Or by URL:
This will install the component and all required dependencies:
import { Combobox } from "@/components/ui/combobox"This module exports the following components:
ComboBoxComboBoxTriggerComboBoxTriggerInputComboBoxContentComboBoxInputComboBoxListComboBoxEmptyComboBoxItemGroupComboBoxItem<ComboBox>| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | - | |
onValueChange | ((arg: string) => void) | - | |
placeholder | string | - | |
value | string | - |
<ComboBoxTriggerInput>| Prop | Type | Default | Description |
|---|---|---|---|
onValueChange | ((search: string) => void) | - | Event handler called when the search value changes. |
value | string | - | Optional controlled state for the value of the search input. |
<ComboBoxInput>| Prop | Type | Default | Description |
|---|---|---|---|
onValueChange | ((search: string) => void) | - | Event handler called when the search value changes. |
value | string | - | Optional controlled state for the value of the search input. |
<ComboBoxList>| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Accessible label for this List of suggestions. Not shown visibly. |
<ComboBoxItemGroup>| Prop | Type | Default | Description |
|---|---|---|---|
forceMount | boolean | - | Whether this group is forcibly rendered regardless of filtering. |
heading | ReactNode | - | Optional heading to render for this group. |
value | string | - | If no heading is provided, you must provide a value that is unique for this group. |
<ComboBoxItem>| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | - | Whether this item is currently disabled. |
forceMount | boolean | - | Whether this item is forcibly rendered regardless of filtering. |
keywords | string[] | - | Optional keywords to match against when filtering. |
onSelect | ((value: string) => void) | - | Event handler for when this item is selected, either via click or keyboard selection. |
value | string | - | A unique value for this item. If no value is provided, it will be inferred from children or the rendered textContent. If your textContent changes between renders, you must provide a stable, unique value. |