Search documentation

Search the documentation and open a page.

An input that allows users to filter and select a value from a list of suggestions.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/combobox

Composition

Combobox ├── ComboboxLabel (optional) ├── ComboboxControl | ComboboxTagsControl │ ├── ComboboxInput | ComboboxTagsInput │ ├── ComboboxTag (multiple values) │ ├── ComboboxClearTrigger (optional) │ └── ComboboxTrigger └── ComboboxContent ├── ComboboxEmpty (optional) ├── ComboboxList │ ├── ComboboxItemGroup │ │ ├── ComboboxItemGroupLabel │ │ └── ComboboxItem │ │ ├── ComboboxItemText │ │ └── ComboboxItemIndicator │ └── ComboboxSeparator (optional)

Examples

Button Trigger

Loading...

Default

Loading...

Groups

Loading...

Multiple Selection

Loading...

Single Selection

Loading...

Sizes

Loading...

With Description

Loading...

API Reference

Combobox

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
openboolean | undefined—Whether the component is open when controlled.
defaultOpenboolean | undefined—Initial open state when uncontrolled.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
inputValuestring | undefined—Configures input value.
defaultInputValuestring | undefined—Configures default input value.
namestring | undefined—Name used when submitting the value with a form.
formstring | undefined—Associates the control with a form by ID.
disabledboolean | undefinedfalseDisables interaction with the component.
readOnlyboolean | undefinedfalsePrevents changes while preserving focus and navigation.
invalidboolean | undefined—Marks the associated form control as invalid.
requiredboolean | undefinedfalseMarks the associated form control as required.
placeholderstring | undefined—Configures placeholder.
defaultHighlightedValuestring | null | undefined—Configures default highlighted value.
highlightedValuestring | null | undefined—Configures highlighted value.
valuestring[] | undefined—Current value when the component is controlled.
defaultValuestring[] | undefined—Initial value when the component is uncontrolled.
inputBehavior"autohighlight" | "autocomplete" | "none" | undefined—Configures input behavior.
selectionBehavior"clear" | "replace" | "preserve" | undefined—Configures selection behavior.
autoFocusboolean | undefined—Configures auto focus.
openOnClickboolean | undefined—Configures open on click.
openOnChangeboolean | ((details: InputValueChangeDetails) => boolean) | undefined—Configures open on change.
allowCustomValueboolean | undefined—Configures allow custom value.
alwaysSubmitOnEnterboolean | undefined—Configures always submit on enter.
loopFocusboolean | undefined—Configures loop focus.
positioningPositioningOptions | undefined—Configures floating-element placement and collision handling.
onInputValueChange((details: InputValueChangeDetails) => void) | undefined—Runs when input value changes.
onValueChange((details: ValueChangeDetails<T>) => void) | undefined—Runs when value changes.
onHighlightChange((details: HighlightChangeDetails<T>) => void) | undefined—Runs when highlight changes.
onSelect((details: SelectionDetails) => void) | undefined—Runs when select changes.
onOpenChange((details: OpenChangeDetails) => void) | undefined—Runs when open changes.
translationsIntlTranslations | undefined—Configures translations.
collectionListCollection<T> | undefined—Collection that supplies the component items.
multipleboolean | undefinedfalseAllows more than one value to be selected or expanded.
closeOnSelectboolean | undefinedtrueConfigures close on select.
openOnKeyPressboolean | undefined—Configures open on key press.
scrollToIndexFn((details: ScrollToIndexDetails) => void) | undefined—Configures scroll to index fn.
compositeboolean | undefined—Configures composite.
disableLayerboolean | undefined—Configures disable layer.
navigate((details: NavigateDetails) => void) | null | undefined—Configures navigate.

Context, Hooks, and Types

ExportAPI
ComboboxContextRender-prop component that exposes component state and actions.
ComboboxRootProviderProvides an externally created API to the component tree.
useComboboxCreates or accesses the component API.
useComboboxContextReturns the nearest component API.
useListCollectionCreates or accesses the component API.
ComboboxInputValueChangeDetailsType for the details object passed to the matching change callback.
ComboboxValueChangeDetailsType for the details object passed to the matching change callback.
useFilterCreates or accesses the component API.

Utilities and Supporting Types

ExportAPI
createListCollectionCreates the typed collection consumed by the component.