Basic

Pass a string array as data for the simplest setup.

Apple
Apricot
Banana
Blueberry
Cherry
Grape
Kiwi
Mango
Orange
Peach
Pear
Pineapple
Raspberry
Strawberry
Watermelon
<Combobox
  data={['Apple', 'Banana', 'Cherry', /* … */]}
  label="Favourite fruit"
  placeholder="Search fruits…"
/>

Object data

Use { value, label } objects when the submitted value differs from the display label — e.g. country codes.

United States
United Kingdom
Germany
France
Japan
Australia
Canada
Brazil
India
China
<Combobox
  data={[
    { value: 'us', label: 'United States' },
    { value: 'gb', label: 'United Kingdom' },
    /* … */
  ]}
  label="Country"
  name="country"
/>

Clearable

Add clearable to show an × button that resets the value.

Apple
Apricot
Banana
Blueberry
Cherry
Grape
Kiwi
Mango
Orange
Peach
Pear
Pineapple
Raspberry
Strawberry
Watermelon
<Combobox data={fruits} value="Mango" clearable />

Description and error

We'll personalise your recommendations.

Apple
Apricot
Banana
Blueberry
Cherry
Grape
Kiwi
Mango
Orange
Peach
Pear
Pineapple
Raspberry
Strawberry
Watermelon
Apple
Apricot
Banana
Blueberry
Cherry
Grape
Kiwi
Mango
Orange
Peach
Pear
Pineapple
Raspberry
Strawberry
Watermelon

Please select a fruit.

<Combobox label="Fruit" description="We'll personalise your recommendations." />
<Combobox label="Fruit" error="Please select a fruit." />

Disabled

Apple
Apricot
Banana
Blueberry
Cherry
Grape
Kiwi
Mango
Orange
Peach
Pear
Pineapple
Raspberry
Strawberry
Watermelon
<Combobox data={fruits} value="Kiwi" disabled />

Keyboard navigation

The Combobox is fully keyboard-accessible without JS enhancements beyond the reactive island itself:

  • Type — filters the option list
  • ↑ / ↓ — moves keyboard focus through matching options
  • Enter — selects the focused option
  • Escape — closes the dropdown and restores the previous value
  • Tab / click outside — closes the dropdown

Props

PropTypeDefaultDescription
datastring[] | Option[][]Option list — strings or { value, label, disabled } objects
valuestringInitially selected value
placeholderstring'Search or select…'Input placeholder
labelstringField label
descriptionstringHelper text shown below the label
errorstring | booleanError message or true to highlight without text
clearablebooleanfalseShow a clear button when a value is selected
disabledbooleanfalsePrevents interaction
nothingFoundstring'Nothing found'Message when no options match the search query
namestringHidden input name for form submission
size'xs'|'sm'|'md'|'lg'|'xl'Controls height and font size
radius'xs'|'sm'|'md'|'lg'|'xl'Border radius