Select
Combobox
NewA field you type into to filter a long list, with the matching part of each option highlighted.
npx motionsnack add combobox-inputCustomize
<ComboboxInput />Props
29 properties
| Property | Type | Default | Description |
|---|---|---|---|
| options | { value, label, description?, group?, disabled? }[] | 25 European cities | Options to pick from. Options with the same group are listed under one heading. |
| value | string | - | Controlled value. Leave undefined to let the component manage it. |
| defaultValue | string | '' | Value on first render when uncontrolled. |
| onChange | (value: string, option?: ComboboxOption) => void | - | Called with the picked value ("" when cleared). Custom text comes without an option. |
| onInputChange | (text: string) => void | - | Called with the typed text on every keystroke (for remote search). |
| filter | (option: ComboboxOption, query: string) => boolean | - | Own match rule. Left out, `match` decides (case- and accent-insensitive). |
| open | boolean | - | Controlled open state of the list. Leave undefined to let the component manage it. |
| defaultOpen | boolean | false | Open state on first render when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | Called whenever the user opens or closes the list. |
| errorColor | string | - | Overrides the error colour on both themes (keep 4.5 : 1). Left out, the theme pair #dc2626 / #ef4444 is used. |
| name | string | - | Name submitted with a form. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'City' | Label above the field. Empty hides it. |
| placeholder | string | 'Start typing a city' | Hint inside the empty field. |
| match | 'contains' | 'startsWith' | 'contains' | How the typed text matches a label. |
| allowCustom | boolean | false | Offer the typed text as a value of its own when no option fits. |
| icon | 'search' | 'none' | 'search' | Icon at the start of the field. |
| emptyText | string | 'No match for "{query}"' | Shown when nothing matches. {query} is the typed text. |
| customText | string | 'Use "{query}"' | Last row that picks the typed text, with Allow Custom. {query} is the typed text. |
| helperText | string | 'We use it to show the nearest studio.' | Small text under the field. Empty hides it. |
| error | string | '' | Error message. Any text marks the field invalid and replaces the helper text. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| readOnly | boolean | false | Focusable and copyable, but the value cannot be changed. |
| loading | boolean | false | Options are being fetched: after 500ms the list shows a loading row. |
| loadingText | string | 'Loading…' | Text of the loading row. |
| height | number | 48 | Height of the field. |
| radius | number | 12 | Corner radius of the field. |
About Combobox
Combobox is for long lists where scrolling would be slow, such as cities, countries or services. The visitor types straight into the field and the list below narrows with every letter, showing the part that matches in full contrast and dimming the rest, by whole-word start or anywhere in the name. Arrow keys move through the results, Enter picks one and Escape closes the list, then clears the field on a second press, following the accessible combobox pattern. When nothing fits, a short message says so; with custom values allowed, a last row offers the typed text itself. A clear button, a search icon and a hidden form value are built in, and the field shares the library's input size, focus outline and error state.
What's included
- Filters as you type, contains or starts with
- Matching part of each option highlighted
- Optional custom value from the typed text
- Groups with headings and two-line options
- Full keyboard support and ARIA combobox roles
- Clear button and hidden form value
- Light and dark look
- Type
- Animated React select component
- Library
- Components · Select
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install