Combobox
A glass field with a list that buds off it and reshapes as you type.
Installation#
$ pnpm dlx shadcn@latest add @liquikit/comboboxNeeds the @liquikit registry in your components.json. Set it up once.
Usage#
import { Combobox } from "@/components/liquikit/combobox"<Combobox.Root items={fruits}>
<Combobox.Input placeholder="Choose a fruit" aria-label="Fruit" />
<Combobox.Popup empty="No fruit found.">
<Combobox.List>
{(fruit: string) => (
<Combobox.Item key={fruit} value={fruit}>
{fruit}
</Combobox.Item>
)}
</Combobox.List>
</Combobox.Popup>
</Combobox.Root>Examples#
Multiple#
Pass multiple to Combobox.Root and use Combobox.Chips in place of the input. Chosen items sit in the field as chips. Remove one with its cross, or with Backspace from the start of the field.
API Reference#
Combobox.Root
| Prop | Type | Default |
|---|---|---|
open | booleanWhether the popup is open. Pair it with | — |
Also takes every prop of Base UI's combobox, plus className and style.
Combobox.Input
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
refraction | "interactive" | "always"When the glass bends the page. | "interactive" |
Also takes every prop of Base UI's combobox, plus className and style.
Combobox.Chips
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
placeholder | stringShown while nothing is chosen. | — |
chipLabel | (item: unknown) => ReactNodeRenders the label inside each chip. Defaults to the item, or its | labelOf |
refraction | "interactive" | "always"When the glass bends the page. | "interactive" |
aria-label | stringAn accessible name, for controls without a visible label. | — |
Combobox.Popup
| Prop | Type | Default |
|---|---|---|
empty | ReactNodeShown in the list when nothing matches. | — |
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
refraction | "interactive" | "always"When the glass bends the page. | "interactive" |
children | ReactNodeThe content. | — |
Also takes every prop of Base UI's combobox, plus className and style.