Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Combobox

  • Needs review
  • WCAG 2.2 evidence
  • RTL

A text field with a filtered list of options. Built on React Aria ComboBox: typing filters the options (a locale-aware "contains" match, or defaultFilter), the arrow keys, Home/End and Page Up/Down move the active option while focus stays in the field, Enter selects, Escape closes the list (and then clears the text); React Aria announces the number of results and the selected option (WCAG 2.1.1, 4.1.2, 4.1.3). The label, helper and error text are linked to the field; errors show as text with an icon, never by colour alone (1.4.1, 3.3.1). With name, the selected key (or keys) is submitted with the form. selectionMode="multiple" keeps the list open while picking and shows the values as removable tags in the field. Use Select for short fixed lists. Consumer duties: label and option wording; translated placeholder, empty and loading text; error text that says how to fix the problem.

import { Combobox } from "@nexera-ui/react";
Loading example…
10
examples
43
props
7
live controls
1
platform
14
WCAG criteria
2
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
placeholder
description
allowsEmptyCollection
isDisabled
isInvalid
isReadOnly
isRequired
Generated code
import { Combobox } from "@nexera-ui/react";

<Combobox />

Examples 9

The same examples as Storybook, rendered live. Open Code to copy one.

States

Filled (defaultValue, with the clear button), Disabled and Error (isInvalid + errorMessage).

Loading example…

Open list

The list open, as wide as the field, with the keyboard hints. The story opens it with the chevron button; the arrow keys move the active option while focus stays in the field.

Loading example…

Multiple selection

Figma Selection=Multiple: the values are Badge-style tags in the field (remove button, or Delete on a focused tag), the options show checkboxes and the list stays open while picking.

Loading example…

Grouped

Grouped options with SelectSection and SelectGroupLabel.

Loading example…

Loading empty and create

Loading, empty and create through listboxProps: type a name that is not in the list to see the Create option, which adds it.

Loading example…

Controlled

Controlled value and text: value / onChange and inputValue / onInputChange.

Loading example…

Composition

Composable parts: ComboboxRoot + FieldLabel + ComboboxTrigger + ComboboxListbox.

Loading example…

Long label

Long labels, helper texts and values wrap.

Loading example…

Right to left

Right-to-left: icons, padding, tags and the list mirror (logical properties).

Loading example…

Props 43

Press "Try it" on a card to load that prop into the playground.

43 props shown

children*Nexera
ReactNode | ((item: T) => ReactNode)

The options: SelectOption elements (optionally grouped in SelectSection with a SelectGroupLabel), or a function that renders one option per item of items / defaultItems.

Default –
placeholderNexera
string

Hint inside the empty text field. Never the only label.

Default –
descriptionNexera
ReactNode

Helper text under the field. Linked with aria-describedby. Replaced by the error message while the field is invalid, as in the Figma Error state.

Default –
errorMessageNexera
ReactNode | ((validation: ValidationResult) => ReactNode)

Error text under the field, shown with an error icon while the field is invalid (isInvalid, or a failed isRequired / validate check on submit) and linked with aria-describedby. Defaults to the validation message. Say what is wrong and how to fix it ("Choose a manager to continue").

Default –
clearLabelNexera
string

Accessible name of the clear button. Translate it for your locale.

Default Clear
selectedTagsLabelNexera
string

Accessible name of the selected values (Selection=Multiple) when there is no visible label. Translate it for your locale.

Default Selected options
listboxPropsNexera
Omit<ComboboxListboxProps<T>, "children" | "items">

Props for the list (ComboboxListbox): isLoading and loadingLabel, emptyTitle and emptyDescription, onCreate and createLabel, keyboardHints, placement.

Default –
classNameNexera
string

Extra classes for the field (label, field box, helper text), merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the field.

Default –
allowsEmptyCollectionNexera
boolean

Whether the list stays open when nothing matches, to show the Figma Empty state (or the Create option).

Default true
labelNexera
FieldLabelContent

Visible label, linked to the control by React Aria (WCAG 1.3.1, 3.3.2). Short noun, for example "Work email". Wraps instead of truncating. A placeholder is never a substitute for it. Not set: the field has no visible label. Not set: the field has no visible label of its own.

Default –
aria-labelNexera
string

Accessible name when it must differ from the visible label. Prefer the visible label (WCAG 2.5.3). Accessible name. Required when there is no visible label; translate it. Accessible name. Optional when aria-labelledby is set.

Default –
aria-labelledbyNexera
string

Id(s) of element(s) that name the field; wins over the visible label. Id(s) of element(s) that name the field; wins over aria-label. Id(s) of visible element(s) that name the field.

Default –
isDisabledReact Aria
boolean

Whether the input is disabled.

Default –
isInvalidReact Aria
boolean

Whether the input value is invalid.

Default –
defaultValueReact Aria
Key | readonly Key[] | null

The default value (uncontrolled).

Default –
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –
onChangeReact Aria
(value: ChangeValueType<M>) => void

Handler that is called when the value changes.

Default –
isReadOnlyReact Aria
boolean

Whether the input can be selected but not changed by the user.

Default –
validationBehaviorReact Aria
"native" | "aria"

Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.

Default 'native'
shouldFocusWrapReact Aria
boolean

Whether keyboard navigation is circular.

Default –
defaultItemsReact Aria
Iterable<T>

The list of ComboBox items (uncontrolled).

Default –
itemsReact Aria
Iterable<T>

The list of ComboBox items (controlled).

Default –
onOpenChangeReact Aria
(isOpen: boolean, menuTrigger?: MenuTriggerAction) => void

Method that is called when the open state of the menu changes. Returns the new open state and the action that caused the opening of the menu.

Default –
selectionModeReact Aria
"single" | "multiple"

Whether single or multiple selection is enabled.

Default 'single'
selectedKeyReact Aria
Key | null

The currently selected key in the collection (controlled). @deprecated

Default –
defaultSelectedKeyReact Aria
Key | null

The initial selected key in the collection (uncontrolled). @deprecated

Default –
onSelectionChangeReact Aria
(key: Key | null) => void

Handler that is called when the selection changes. @deprecated

Default –
inputValueReact Aria
string

The value of the ComboBox input (controlled).

Default –
defaultInputValueReact Aria
string

The default value of the ComboBox input (uncontrolled).

Default –
onInputChangeReact Aria
(value: string) => void

Handler that is called when the ComboBox input value changes.

Default –
allowsCustomValueReact Aria
boolean

Whether the ComboBox allows a non-item matching input value to be set.

Default –
menuTriggerReact Aria
"focus" | "input" | "manual"

The interaction required to display the ComboBox menu.

Default 'input'
disabledKeysReact Aria
Iterable<Key>

The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.

Default –
valueReact Aria
Key | readonly Key[] | null

The current value (controlled).

Default –
isRequiredReact Aria
boolean

Whether user input is required on the input before form submission.

Default –
validateReact Aria
(value: ComboBoxValidationValue<M>) => true | ValidationError | null

A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.

Default –
nameReact Aria
string

The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).

Default –
formReact Aria
string

The <form> element to associate the input with. The value of this attribute must be the id of a <form> in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).

Default –
defaultFilterReact Aria
(textValue: string, inputValue: string) => boolean

The filter function used to determine if an option should be included in the combo box list. By default, a language-sensitive "contains" filter from useFilter is used.

Default –
formValueReact Aria
"text" | "key"

Whether the text or key of the selected item is submitted as part of an HTML form. When allowsCustomValue is true, this option does not apply and the text is always submitted.

Default 'key'

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

8 direct · 6 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.3Focus OrderLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 3.3.1Error IdentificationLevel A · tested directly
  • 3.3.2Labels or InstructionsLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-focus-visible
  • data-hovered
Usage
<Combobox className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components