Skip to content
SevenUI
Sign inGet Pro
On this page

Combobox

An input combined with a filterable popup list, built on the Base UI Combobox primitive.

An input combined with a filterable popup list, built on the UI SDK Combobox component.

Installation

Usage

Examples

Multiple with chips

Selected items render as removable chips inside ComboboxChips. Anchor the popup to the chips container with useComboboxAnchor: ref={anchor} on the chips, anchor={anchor} on the content.

API reference

The UI SDK flavour is built on UI SDK Combobox, SevenUI Button and SevenUI Input Group. Its API is the SevenUI wrapper's, the same in both flavours: export names, props, data-slot values and the render prop, so code that uses only the SevenUI exports compiles against either flavour. What behaves differently, and any prop that is ignored or not supported, is listed below; code that imports a Base UI or third-party library directly needs changes. Switch to Base UI to read the prop tables, which describe that shared API in Base UI's terms.

Differences on UI SDK

  • Popups open in the browser's top layer (the Popover API), rendered into <body> as Base UI's are, with no Positioner element; side="inline-start"/"inline-end" map to start/end. Callback details.reason strings are UI SDK's (for example trigger-press, escape-key, outside-press). An initialFocus or finalFocus function receives "mouse" as its interaction, and one that returns nothing hands focus back to the trigger.
  • Filtered-out items stay mounted with hidden. Base UI's filter(item, query), filter={null}, itemToStringLabel/itemToStringValue, inputValue, loopFocus and onItemHighlighted map to UI SDK's own filter, labels, query, loop and highlight.
  • After typing with a value selected, the first match stays highlighted, so Enter chooses it; Base UI highlights nothing until an arrow key.
  • id, inputRef, actionsRef, openOnInputClick, highlightItemOnHover, autoComplete, limit, locale, grid, virtualized, inline and filteredItems on the root are accepted and ignored.

Combobox

Extends the Base UI Combobox Root — all its props apply.

PropTypeDefault
itemsitem array (or { label, value }[])—
value / defaultValueitem (array when multiple)—
onValueChange(value) => void—
multiplebooleanfalse
disabled / required / readOnlybooleanfalse

items drives the automatic filtering as the user types and lets ComboboxEmpty know when nothing matches.

ComboboxList

Takes a function child — (item) => ReactElement — called once per item currently matching the input value; return a ComboboxItem for each, so filtering re-renders the list automatically.

ComboboxInput

Renders the Combobox.InputGroup → Combobox.Input pair, with ComboboxClear and ComboboxTrigger positioned inside the group as inline controls. Its className styles the field container — size the field with it (e.g. className="w-64").

ComboboxContent

Renders through Combobox.Portal → Combobox.Positioner → Combobox.Popup, mirroring Select.

PropTypeDefault
side / alignpositioner placement"bottom" / "start"
sideOffset / alignOffsetnumber6 / 0
anchorelement ref to anchor totrigger

ComboboxChips, ComboboxChip, ComboboxChipsInput

Multi-select chips: ComboboxChips is the bordered container (attach the useComboboxAnchor ref here), ComboboxChip renders one selected item with a built-in remove button, and ComboboxChipsInput is the inline filter input.

Prop (ComboboxChip)TypeDefault
showRemovebooleantrue

ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxValue, ComboboxTrigger

Styled Base UI parts. useComboboxAnchor() is exported as a convenience ref hook for the chips anchoring pattern.

Was this page helpful?