Combobox
ProNewA searchable select for long lists, with descriptions, icons, a clear button and prefix matches ranked first.
Installation
pnpm dlx shadcn@latest add @viewport/combobox
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| options* | ComboboxOption[] | — |
| value | string | null | — |
| defaultValue | string | null | null |
| onValueChange | (value: string | null) => void | — |
| placeholder | stringShown in the closed control while nothing is selected. | "Select…" |
| searchPlaceholder | stringPlaceholder and accessible name of the search field. | "Search…" |
| emptyText | stringShown when the search matches nothing. | "No results" |
| clearable | booleanShow a button that clears the selection. | false |
Accessibility
- The combobox pattern: focus stays in the search field while arrow keys move the highlight.
- The number of results is announced as you type.
- Disabled options are skipped by the keyboard.
- No scale animation under reduced motion.