Combobox

Picks one option from a long list by typing to filter.

@paneui/theme@paneui/icons@paneui/control-size@paneui/locale-provider@base-ui/reactclass-variance-authority

Installation

pnpm dlx shadcn@latest add @paneui/combobox

Usage

Composition

Examples

Sizes

Input Options

Turn off controls a field doesn't need, like the clear button when a choice is required.

Controlled

Disabled

RTL

Keyboard

Typing filters the list; ArrowUp / ArrowDown move the highlight, Enter picks it and Escape closes the popup (standard combobox behaviour).

Multi Select is the same primitive in multiple mode, with chips.

API Reference

Built on the Combobox primitive. Only the props this library adds or changes are listed; everything else passes through.

Combobox

Re-export of the primitive root, taking items, value, defaultValue, onValueChange, filter, disabled and its other props. Also accepts every prop of Combobox.Root.

ComboboxInput

Search input in an inset well with optional search icon, clear and chevron buttons. Also accepts every prop of Combobox.Input.

size= "default"
"xs" | "sm" | "default" | "lg"
Height 24 / 28 / 32 / 36px. Defaults to the Combobox size, then a sized Field.
showSearchIcon= true
boolean
Show the leading search icon.
showClear= true
boolean
Render a clear button, shown once something is chosen.
showTrigger= true
boolean
Render the chevron that opens the list.
PropTypeDefaultDescription
size"xs" | "sm" | "default" | "lg""default"Height 24 / 28 / 32 / 36px. Defaults to the Combobox size, then a sized Field.
showSearchIconbooleantrueShow the leading search icon.
showClearbooleantrueRender a clear button, shown once something is chosen.
showTriggerbooleantrueRender the chevron that opens the list.
data-size
On the input group, the size value.
data-disabled
On the input group while disabled.
Data attributeDescription
data-sizeOn the input group, the size value.
data-disabledOn the input group while disabled.

ComboboxTrigger

Raised button showing the chosen value, like SelectTrigger. Put ComboboxValue inside. Also accepts every prop of Combobox.Trigger.

size= "default"
"xs" | "sm" | "default" | "lg"
Height 24 / 28 / 32 / 36px. Defaults to the Combobox size, then a sized Field.
PropTypeDefaultDescription
size"xs" | "sm" | "default" | "lg""default"Height 24 / 28 / 32 / 36px. Defaults to the Combobox size, then a sized Field.
data-popup-open
Present while the list is open.
Data attributeDescription
data-popup-openPresent while the list is open.

ComboboxValue

Re-export. Renders the selected value, or placeholder when empty. Also accepts every prop of Combobox.Value.

ComboboxSearch

Search field styled for the top of the popup. Also accepts every prop of Combobox.Input.

ComboboxContent

Portal, positioner and popup in one. As wide as its anchor. Also accepts every prop of Combobox.Popup.

side= "bottom"
"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"
Side of the anchor to place the popup on.
sideOffset= 6
number
Gap from the anchor in px.
align= "start"
"start" | "center" | "end"
Alignment against the anchor.
anchor
Element | RefObject<Element> | VirtualElement | null
Position against another element.
PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end""bottom"Side of the anchor to place the popup on.
sideOffsetnumber6Gap from the anchor in px.
align"start" | "center" | "end""start"Alignment against the anchor.
anchorElement | RefObject<Element> | VirtualElement | null—Position against another element.

ComboboxList

Scrollable list. Takes a render function called per item (or group). Also accepts every prop of Combobox.List.

ComboboxItem

Option row with a check indicator on the right when selected. Also accepts every prop of Combobox.Item.

data-highlighted
Present on the keyboard / pointer highlighted item.
data-disabled
Present when the item is disabled.
Data attributeDescription
data-highlightedPresent on the keyboard / pointer highlighted item.
data-disabledPresent when the item is disabled.

ComboboxGroup

Also accepts every prop of Combobox.Group.

ComboboxLabel

Also accepts every prop of Combobox.GroupLabel.

ComboboxSeparator

Also accepts every prop of Combobox.Separator.

ComboboxEmpty

Shown only when the filter leaves nothing to pick. Also accepts every prop of Combobox.Empty.

ComboboxCollection

Re-export. Renders a group's items with a render function. Also accepts every prop of Combobox.Collection.

useComboboxFilter

Re-export of Combobox.useFilter, returning locale-aware contains, startsWith and endsWith matchers for filter. Also accepts every prop of Combobox.useFilter.