Skip to content

Combobox

InputMIT
View in Storybook

Autocomplete combo box with searchable options and keyboard navigation.

bun add @otfdashkit/ui

Preview

Combobox
Loading Storybook preview…

Code

import 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.

PropTypeDefaultDescription
optionsrequiredComboboxOption[]
classNamestring
contentWidth'trigger' | 'auto''trigger'Width of the popover content. Defaults to match the trigger.
disabledboolean
emptyMessagestring'No results.'
onChange(value: string) => void
placeholderstring'Select…'
searchPlaceholderstring'Search…'
valuestring