Combobox
InputMITAutocomplete combo box with searchable options and keyboard navigation.
bun add @otfdashkit/ui
Preview
ComboboxInput
Loading Storybook preview…
Code
@otfdashkit/uiimport React from 'react'
import { Combobox } from '@otfdashkit/ui'
const FRAMEWORKS = [
{ value: 'next', label: 'Next.js', description: 'React framework by Vercel' },
{ value: 'remix', label: 'Remix', description: 'Full-stack React framework' },
{ value: 'astro', label: 'Astro', description: 'Content-first, MPA-style' },
{ value: 'svelte', label: 'SvelteKit', description: 'Svelte app framework' },
{ value: 'solid', label: 'SolidStart', description: 'Fine-grained reactivity' },
{ value: 'nuxt', label: 'Nuxt', description: 'Intuitive Vue framework' },
{ value: 'qwik', label: 'Qwik City', description: 'Resumable framework' },
]
export function Example() {
const [value, setValue] = React.useState<string>()
return (
<div className="w-72">
<Combobox
options={FRAMEWORKS}
value={value}
onChange={setValue}
placeholder="Pick a framework…"
/>
</div>
)
}
Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the Combobox source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| optionsrequired | ComboboxOption[] | ||
| className | string | ||
| contentWidth | 'trigger' | 'auto' | 'trigger' | Width of the popover content. Defaults to match the trigger. |
| disabled | boolean | ||
| emptyMessage | string | 'No results.' | |
| onChange | (value: string) => void | ||
| placeholder | string | 'Select…' | |
| searchPlaceholder | string | 'Search…' | |
| value | string |