suiss/uim · React Native Component

Combobox

A text input that filters a list of options as you type, for single or multiple selection.

Combobox is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Combobox (open by default) on iOS in light mode

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

$ pnpm dlx @esuiss/uim@latest add combobox

The CLI also adds what it builds on: Button, Icon, Text.

Manual

  1. Install the dependencies:
npx expo install cn phosphor-react-native react-native-reanimated react-native-screens react-native-svg react-native-worklets
  1. Add the pieces it builds on: Button, Icon, Text, and the primitives components/primitives/combobox.tsx, components/primitives/field.tsx, components/primitives/positioner.tsx, components/primitives/use-render.tsx.

  2. Copy the source into components/ui/combobox.tsx:

uniwind/components/ui/combobox.tsx
import { cn } from "cn"
import { CaretDownIcon, CheckIcon, XIcon } from "phosphor-react-native"
import * as React from "react"
import {
  Platform,
  type StyleProp,
  type View,
  type ViewStyle,
} from "react-native"
import { FadeIn, FadeOut, ReduceMotion } from "react-native-reanimated"
import { FullWindowOverlay as RNFullWindowOverlay } from "react-native-screens"
import * as ComboboxPrimitive from "@/components/primitives/combobox"
import { useFieldRootContext } from "@/components/primitives/field"
import { useOptionalPositionerContext } from "@/components/primitives/positioner"
import {
  resolveClassName,
  1. Update the import paths to match your project.

Usage

import { ComboboxTrigger, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput } from "@/components/ui/combobox"
<ComboboxDemo defaultValue="Expo" defaultOpen />

Pass items to the root and render the filtered list with a function child of ComboboxList. For grouped items, render a ComboboxGroup per group with a ComboboxLabel and a ComboboxCollection. Add ComboboxEmpty for the no-results message.

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.

With chips, 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. On ComboboxInput, set showClear to add a clear button and showTrigger={false} to hide the caret.

Examples

Default

iOS
Combobox on iOS in light mode

With value

Starts with a selected value.

iOS
Combobox (with value) on iOS in light mode

With clear

A clear button through showClear.

iOS
Combobox (with clear) on iOS in light mode

Grouped

Items in labelled groups with separators.

iOS
Combobox (grouped) on iOS in light mode

Multiple

Multiple selection shown as removable chips.

iOS
Combobox (multiple) on iOS in light mode

With label

Linked to a Label with helper text.

iOS
Combobox (with label) on iOS in light mode

Disabled

A disabled combobox.

iOS
Combobox (disabled) on iOS in light mode

Invalid

The invalid style with an error message.

iOS
Combobox (invalid) on iOS in light mode

API Reference

ComboboxTrigger

Round button that opens the list.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Trigger>
PropType
Type
React.ReactNode
Default
—

ComboboxInput

Text field with caret trigger and optional clear button.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Input>
PropType
Type
string
Default
—
Type
React.ReactNode
Default
—
About
Shows the caret button. Defaults to true.
Type
boolean
Default
true
About
Shows a clear button when there is text or a value.
Type
boolean
Default
false
About
Shows the danger border; also read from a surrounding Field.
Type
boolean
Default
—

ComboboxContent

Floating popup for the list.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Popup>PositionerProps
PropType
About
Name of the portal host to render into.
Type
string
Default
—

ComboboxList

Scrollable list of items.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.List>

ComboboxItem

Selectable option with a check mark when selected.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Item>
PropType
Type
React.ReactNode
Default
—

ComboboxGroup

Group of items.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Group>

ComboboxLabel

Heading for a group.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.GroupLabel>

ComboboxEmpty

Message shown when nothing matches.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Empty>

ComboboxSeparator

Line between groups.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Separator>

ComboboxChips

Field that holds chips for multiple selection.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Chips>
PropType
About
Shows the danger border.
Type
boolean
Default
—

ComboboxChip

Selected value with a remove button.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Chip>
PropType
About
Shows the remove button. Defaults to true.
Type
boolean
Default
true

ComboboxChipsInput

Text input inside the chips field.

ExtendsReact.ComponentProps<typeof ComboboxPrimitive.Input>

Accessibility

  • The input has the combobox role with expanded and disabled state.
  • Items have the option role with selected and disabled state; the list has the list role.
  • The empty message is a polite live region.
  • The trigger, clear and chip remove buttons are labelled "Show options", "Clear" and "Remove".

Notes

  • Uses bg-control, bg-surface-raised, border-focus and border-danger tokens; light and dark follow the system appearance.
  • Fade animations respect the system Reduce Motion setting.