suiss/ui · Component
Combobox
A text input with a filterable list of options, for choosing one or more values by typing.
Combobox is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Combobox is built on the Base UI Combobox. The Combobox root takes the items to choose from and holds the value. ComboboxInput renders the text field inside an InputGroup, with an optional button that opens the list and an optional clear button. ComboboxContent renders the popup in a portal; inside it, ComboboxList renders each item through a render function, ComboboxEmpty appears when nothing matches, and ComboboxItem shows a check mark when selected. Group related items with ComboboxGroup, ComboboxLabel, ComboboxCollection and ComboboxSeparator.
For multiple selection, replace ComboboxInput with ComboboxChips, which shows each selected value as a ComboboxChip next to a ComboboxChipsInput. Use a combobox when the list is long enough that typing to filter helps. For a short, fixed list without filtering, use a select; for a list of actions rather than values, use a command menu.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
-
Add the pieces it builds on: Button, Input Group.
-
Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Composition
Use the following composition to build a Combobox:
Examples
With clear button
Set showClear on ComboboxInput to show a clear button at the end of the field. When shown, it hides the open button. This combobox also starts with a value.
Disabled
Set disabled on ComboboxInput to disable the field and its buttons, so they cannot be focused or used.
Grouped
Pass groups as items, render a ComboboxGroup with its own items for each one, and render its items with ComboboxCollection. Labels and separators divide the regions.
Highlight match
Control the typed text with inputValue and onInputValueChange, and use it to emphasize the matching part of each option.
Multiple
Set multiple on the root, create a ref with useComboboxAnchor, attach it to ComboboxChips, and pass it as anchor to ComboboxContent. ComboboxValue maps the selected values to removable chips, and Backspace removes the last chip.
Accessibility
- The input has the
comboboxrole and setsaria-expandedto reflect whether the list is open. - The popup has the
listboxrole, options have theoptionrole and selected options setaria-selected; groups have thegrouprole and take their name fromComboboxLabel. - Typing filters the options. Arrow keys move the highlight, Enter selects the highlighted option, and Escape closes the list.
- In multiple selection, Backspace in the empty input removes the last chip.
- The open button is labelled
Show optionsand the clear button is labelledClear. - When disabled, the input and the open button are disabled and removed from the Tab order.
- Give the input an accessible name with a visible label or
aria-label.
API Reference
Combobox
The root that holds the items, the selected value and the open state.
Also accepts the props of ComboboxPrimitive.Root.
Pass items to the root and a function as the child of ComboboxList, which receives each item and returns a ComboboxItem with a matching value. The value is uncontrolled with defaultValue, or controlled with value and onValueChange. To read or control the typed text, use inputValue and onInputValueChange.
ComboboxValue
Renders the current value, or passes it to a render function, for example to draw chips.
Also accepts the props of ComboboxPrimitive.Value.Props.
ComboboxTrigger
A button that opens the list, with a caret icon.
Also accepts the props of ComboboxPrimitive.Trigger.Props.
ComboboxInput
The text field, rendered inside an InputGroup with optional open and clear buttons.
| Prop | Type | Default |
|---|---|---|
showTrigger | boolean | true |
showClear | boolean | false |
disabled | boolean | false |
Also accepts the props of ComboboxPrimitive.Input.Props.
showTrigger shows the button at the end of the field that opens the list. showClear shows a clear button, which hides the open button. disabled disables the field and its buttons.
ComboboxContent
The popup, rendered in a portal and positioned below the input.
| Prop | Type | Default |
|---|---|---|
side | "top" | "bottom" | "left" | "right" | "inline-start" | "inline-end" | "bottom" |
sideOffset | number | 6 |
align | "start" | "center" | "end" | "start" |
alignOffset | number | 0 |
anchor | Element | React.RefObject<Element | null> | null | — |
Also accepts the props of ComboboxPrimitive.Popup.Props.
side and align place the popup against its anchor, and sideOffset and alignOffset are in pixels. anchor is the element to position against, such as the ref from useComboboxAnchor; it defaults to the input. The popup matches the width of its anchor through --anchor-width and limits its height to the available space.
ComboboxList
The scrollable list that renders items through a render function.
Also accepts the props of ComboboxPrimitive.List.Props.
ComboboxItem
A selectable option that shows a check mark when selected.
Also accepts the props of ComboboxPrimitive.Item.Props.
Highlighted items get data-highlighted and disabled items get data-disabled.
ComboboxGroup
Groups related options and takes its own items.
Also accepts the props of ComboboxPrimitive.Group.Props.
ComboboxLabel
The visible label of a group.
Also accepts the props of ComboboxPrimitive.GroupLabel.Props.
ComboboxCollection
Renders the items of a group through a render function.
Also accepts the props of ComboboxPrimitive.Collection.Props.
ComboboxEmpty
Content shown when no options match the typed text.
Also accepts the props of ComboboxPrimitive.Empty.Props.
ComboboxSeparator
A divider between groups.
Also accepts the props of ComboboxPrimitive.Separator.Props.
ComboboxChips
The field that holds selected values as chips in multiple selection.
Also accepts the props of ComboboxPrimitive.Chips.Props, including ref.
ComboboxChip
A selected value shown as a chip, with an optional remove button.
| Prop | Type | Default |
|---|---|---|
showRemove | boolean | true |
removeLabel | string | Remove {value} |
Also accepts the props of ComboboxPrimitive.Chip.Props.
showRemove shows a button inside the chip that removes the value. removeLabel is the accessible name of that button.
ComboboxChipsInput
The text field placed after the chips in multiple selection.
Also accepts the props of ComboboxPrimitive.Input.Props.
useComboboxAnchor
Returns a ref for ComboboxChips. Pass the same ref as anchor to ComboboxContent so the popup aligns to the chips field.
Each part sets a data-slot, such as combobox-item or combobox-chip-remove, for styling.
Web preview
Combobox pairs a text input with a floating list that filters its items as the user types. ComboboxInput draws the field with a caret trigger and an optional clear button, and ComboboxContent renders the list through a portal (inside a full-window overlay on iOS), positioned below the input and as wide as it.
For multiple selection, set multiple and use ComboboxChips with a ComboboxChip per selected value and a ComboboxChipsInput for typing. Each chip has a remove button.
Installation
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/combobox.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/combobox.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/combobox.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Default
Web preview
With value
Set an initial value so the combobox starts with a selection.

With clear
A clear button through showClear.
Web preview
Grouped
Items in labelled groups with separators.
Web preview
Multiple
Multiple selection shown as removable chips.
Set multiple and create a ref with useComboboxAnchor(). Attach it to ComboboxChips, and pass it to ComboboxContent as anchor so the list lines up with the chips field.
Web preview
With label
Linked to a Label with helper text.

Disabled
A disabled combobox.
Web preview
Invalid
The invalid style with an error message.

The React Native tab shows 1 more example.
Accessibility
- The input has the
comboboxrole withexpandedanddisabledstate. - Items have the
optionrole withselectedanddisabledstate; the list has thelistrole. - The empty message is a polite live region.
- The trigger, clear and chip remove buttons are labelled "Show options", "Clear" and "Remove".
API Reference
Combobox
The root that holds the items, the selected value, the typed text and the open state.
| Prop | Type | Default |
|---|---|---|
items | Item[] | ComboboxItemGroup<Item>[] | - |
value | Value | Value[] | null | - |
defaultValue | Value | Value[] | null | - |
onValueChange | (value, details) => void | - |
multiple | boolean | false |
inputValue | string | - |
onInputValueChange | (inputValue: string, details) => void | - |
filter | ComboboxFilter<Item> | null | - |
limit | number | - |
itemToStringLabel | (itemValue: Value) => string | - |
openOnInputClick | boolean | true |
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean, details) => void | - |
disabled | boolean | false |
readOnly | boolean | false |
Pass items, flat or grouped, and render the filtered list with a function child of ComboboxList. Use value, defaultValue and onValueChange for the selection, and inputValue with onInputValueChange for the typed text. For object items, provide itemToStringLabel. filter, limit and locale tune matching: a null filter turns filtering off, and limit caps the number of items shown. readOnly shows the value without allowing changes.
ComboboxTrigger
Round button that opens the list.
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Trigger>.
ComboboxInput
Text field with caret trigger and optional clear button.
| Prop | Type | Default |
|---|---|---|
className | string | - |
children | React.ReactNode | - |
showTrigger | boolean | true |
showClear | boolean | false |
invalid | boolean | - |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Input>.
Set showClear to add a clear button, shown when there is text or a value, and showTrigger={false} to hide the caret. invalid shows the destructive border; it is also read from a surrounding Field. Focus turns the border outline to ring with a solid ring.
ComboboxContent
Floating popup for the list.
| Prop | Type | Default |
|---|---|---|
portalHost | string | - |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Popup>, PositionerProps.
portalHost names the portal host to render into. Fade animations respect the system Reduce Motion setting.
ComboboxList
Scrollable list of items.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.List>.
ComboboxItem
Selectable option with a check mark when selected.
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Item>.
ComboboxGroup
Group of items.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Group>.
For grouped items, render a ComboboxGroup per group with a ComboboxLabel and a ComboboxCollection.
ComboboxLabel
Heading for a group.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>.
ComboboxEmpty
Message shown when nothing matches.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Empty>.
Add it for the no-results message.
ComboboxSeparator
Line between groups.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Separator>.
ComboboxChips
Field that holds chips for multiple selection.
| Prop | Type | Default |
|---|---|---|
invalid | boolean | - |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Chips>.
ComboboxChip
Selected value with a remove button.
| Prop | Type | Default |
|---|---|---|
showRemove | boolean | true |
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Chip>.
ComboboxChipsInput
Text input inside the chips field.
Also accepts the props of React.ComponentProps<typeof ComboboxPrimitive.Input>.
Combobox
The root that holds the items, the selected value, the typed text and the open state.
| Parameter | Type | Default |
|---|---|---|
_Â items | [Item] | - |
selection | Binding<Item?> | - |
placeholder | LocalizedStringKey | "Select" |
searchPlaceholder | LocalizedStringKey | "Search" |
emptyText | LocalizedStringKey | "No items found." |
title | (Item) -> String | - |
Overloads: init(_:selection:placeholder:searchPlaceholder:emptyText:title:), init(_:selection:placeholder:searchPlaceholder:emptyText:title:), init(_:selection:placeholder:searchPlaceholder:emptyText:), init(_:selection:placeholder:searchPlaceholder:emptyText:).
Combobox
The root that holds the items, the selected value, the typed text and the open state.
| Parameter | Type | Default |
|---|---|---|
items | List<T> | - |
value | T? | - |
onValueChange | (T?) -> Unit | - |
modifier | Modifier | Modifier |
itemText | (T) -> String | { it.toString() } |
placeholder | String | "" |
emptyText | String | "No items found." |
groupBy | ((T) -> String)? | null |
showTrigger | Boolean | true |
showClear | Boolean | false |
invalid | Boolean? | null |
enabled | Boolean | true |
filter | (T, String) -> Boolean | { item, query -> itemText(item).contains(query, ignoreCase = true) } |
MultiCombobox
| Parameter | Type | Default |
|---|---|---|
items | List<T> | - |
values | List<T> | - |
onValuesChange | (List<T>) -> Unit | - |
modifier | Modifier | Modifier |
itemText | (T) -> String | { it.toString() } |
placeholder | String | "" |
emptyText | String | "No items found." |
groupBy | ((T) -> String)? | null |
invalid | Boolean? | null |
enabled | Boolean | true |
filter | (T, String) -> Boolean | { item, query -> itemText(item).contains(query, ignoreCase = true) } |


