Components
Combobox
A text field that filters a list of options, with an optional create row and chips for several values.
Ombelle · light
Combobox
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add comboboxAdds components/ui/combobox.tsx and installs react, @radix-ui/react-popover, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxCreate, ComboboxEmpty } from '@/components/ui/combobox'
export function Example(){return <Combobox defaultValue="ombelle" onCreate={name => console.log('Create', name)}><ComboboxInput aria-label="Preset" placeholder="Search presets" /><ComboboxContent><ComboboxList><ComboboxItem value="liquid-glass">Liquid glass</ComboboxItem><ComboboxItem value="ombelle">Ombelle</ComboboxItem><ComboboxCreate /></ComboboxList><ComboboxEmpty>No presets found.</ComboboxEmpty></ComboboxContent></Combobox>}API and states
- API
- Combobox (value, onValueChange, multiple, onCreate, name, disabled), ComboboxInput, ComboboxContent, ComboboxList, ComboboxGroup (heading), ComboboxItem (value), ComboboxCreate, ComboboxEmpty, highlightMatch
- Minimum states
- Closed, open, filtered, empty, create offered, chips, disabled
- Native basis
- cmdk in Radix Popover; Base UI Combobox in the Base UI edition
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.