structyl

Combobox

stable

An autocomplete input with a filtered list of options.

Basic usage

Examples

Controlled value

Track the selected value externally to drive other parts of the UI.

Large searchable collection

Combobox is useful when users need to search through application data.

Features

  • Search filtering.
  • Keyboard navigation.

Installation

bash
pnpm dlx structyl add combobox

API Reference

Combobox.Root

A searchable autocomplete select.

PropTypeDefault
valuestring

Controlled selected value.

onValueChange(value: string) => void

Called when the selection changes.

inputValuestring

Controlled input text.

onInputValueChange(value: string) => void

Called when the input text changes.

openboolean

Controlled open state.

onOpenChange(open: boolean) => void

Called when open state changes.

disabledboolean

Disable the combobox.

false

Combobox.Input

The search input.

PropTypeDefault
classNamestring

Additional Tailwind classes, merged with the component defaults.

Combobox.Content

The results listbox.

PropTypeDefault

Combobox.Item

A result option.

PropTypeDefault
valuestring

The option value.

disabledboolean

Disable the option.

Combobox.Empty

Shown when no results match.

PropTypeDefault
Combobox | structyl