0.1.0-rc.2

Combobox

A combobox combines a text field with a filterable popup list. Use it when users may type a value or pick from suggestions.

Try it

Usage

Compose RuiComboboxControl, RuiComboboxInput, RuiComboboxTrigger, and RuiComboboxListbox with RuiListboxOption children.

import { RuiCombobox, RuiComboboxControl, RuiComboboxInput, RuiComboboxTrigger, RuiComboboxListbox } from '@ecopages/radiant-ui/combobox';
import { RuiListbox, RuiListboxOption } from '@ecopages/radiant-ui/listbox';
 
<RuiCombobox value="cat" placeholder="Choose an animal">
  <RuiComboboxControl>
    <RuiComboboxInput />
    <RuiComboboxTrigger />
  </RuiComboboxControl>
  <RuiComboboxListbox>
    <RuiListbox>
      <RuiListboxOption value="cat">Cat</RuiListboxOption>
      <RuiListboxOption value="dog">Dog</RuiListboxOption>
    </RuiListbox>
  </RuiComboboxListbox>
</RuiCombobox>

Open on focus

Enable openOnFocus when the option set is small and users benefit from seeing choices immediately. Disable it for large datasets.

Allow custom values

Comboboxes accept typed input that may not match an option. Validate on submit if only predefined values are permitted.

Theming

Combobox surfaces map to semantic surface roles, never Tailwind palette steps:

PartCSS roles
Control row (rui-combobox__control)border, background, radius-control; focus-ring ring on focus-within
Input texton-background, --text-control, --space-control-*
Disabledopacity-muted
Popup (rui-combobox__listbox)popover surface + shadow-overlay (via rui-popover)

Geometry shares control tokens (--size-control-*, --radius-control, --space-control-*) with RuiInput and RuiButton so form rows align. Override at the theme layer, not in component CSS.

API

RuiCombobox is a custom element (<rui-combobox>) that coordinates a slotted input row and listbox popup; the view helpers own the composed surface.

Attributes

AttributeTypeDefaultDescription
valuestring''Selected option value.
labelstring''Accessible name when there is no visible RuiLabel.
placeholderstring''Placeholder text for the input.
disabledbooleanfalseDisable the input and trigger.
open-on-focusbooleanfalseOpen the listbox when the input gains focus.

Slots

SlotDescription
controlInput row: RuiComboboxControl with RuiComboboxInput (+ optional RuiComboboxTrigger).
listboxPopup shell: RuiComboboxListbox containing an embedded RuiListbox.

Events

EventDetailDescription
rui-change{ value }Fired when an option is selected (or Esc clears the value).

View helpers

ComponentRendersSlot
RuiComboboxControlInput row wrappercontrol
RuiComboboxInputText input (role="combobox")
RuiComboboxTriggerPopup toggle button
RuiComboboxListboxPopup shell (rui-popover)listbox

CSS classes

Public BEM classes (documented via @cssclass):

ClassDescription
.rui-comboboxRoot surface.
.rui-combobox__controlBordered control-height row.
.rui-combobox__inputCombobox text input.
.rui-combobox__listboxPopup shell (adds rui-popover rui-popover--listbox rui-floating).

Theme roles

PartCSS variables consumed
Control row--border, --background, --radius-control, --focus-ring
Input text--on-background, --text-control, --space-control-x, --space-control-y
Disabled--opacity-muted
Popup--shadow-overlay (via rui-popover)

Accessibility

  • The input exposes role="combobox" with aria-expanded reflecting popup state.
  • Associate a visible label via label or RuiLabel.
  • Announce the number of filtered results when the list changes substantially.