0.1.0-rc.2

Select

Selects let users choose one or more values from a predefined list inside a compact trigger and popup listbox.

Try it

Usage

Pass options for a simple API, or compose RuiSelectControl, RuiSelectTrigger, RuiSelectValue, and RuiSelectListbox for full control.

import { RuiSelect } from '@ecopages/radiant-ui/select';
import { RuiLabel } from '@ecopages/radiant-ui/label';
 
<RuiLabel>Animal</RuiLabel>
<RuiSelect
  value="cat"
  placeholder="Select an animal"
  options={[
    { value: 'cat', label: 'Cat' },
    { value: 'dog', label: 'Dog' },
  ]}
/>

Multiple selection

Set selectionMode="multiple" for multi-select. Selected values appear as tags via RuiTagGroup.

Searchable lists

Add RuiSelectSearch inside the listbox for long option sets that benefit from filtering.

Theming

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

PartCSS roles
Trigger (rui-select__trigger)on-background, border on the control row
Control row (rui-select__control)border, background, rounded-control
Popup (rui-select__listbox)popover surface + shadow-overlay
Selected value / toggleon-surface

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

Accessibility

  • The trigger exposes aria-expanded and aria-haspopup="listbox".
  • Selected values are reflected in RuiSelectValue for screen readers.
  • Provide a visible label; the placeholder is not a substitute.

API

RuiSelect is a custom element (<rui-select>) wrapping a button trigger and an embedded RuiListbox. Pass options for the simple API, or compose the view helpers for full control.

Attributes (<rui-select>)

AttributeTypeDefaultDescription
valuestring''Selected value (comma-joined for multiple).
labelstring''Accessible name when there is no associated RuiLabel.
placeholderstring''Placeholder shown when nothing is selected.
disabledbooleanfalseDisabled state.
selection-modesingle ยท multiplesingleSingle or multi-select.
should-close-on-selectbooleanWhether selecting closes the popup (defaults to true for single, false for multiple).

Events

EventDetailDescription
rui-change{ value: string }Emitted after a selection changes.

View helpers

ComponentRendersSlot
RuiSelectControlTrigger row wrappertrigger
RuiSelectTriggerValue button (role="combobox")
RuiSelectValueSelected value / placeholder text
RuiSelectTogglePopup toggle icon button
RuiSelectListboxPopup shell (rui-popover)listbox
RuiSelectSearchFiltering input inside the popup

CSS classes

Public BEM classes (documented via @cssclass):

ClassDescription
.rui-select__controlTrigger row: bordered control-height surface.
.rui-select__triggerValue button with role="combobox".
.rui-select__valueSelected value / placeholder text.
.rui-select__listboxPopup shell (adds rui-popover rui-popover--listbox rui-floating).
.rui-select__searchFiltering input inside the popup.

Theme roles

PartCSS variables consumed
Control row--border, --background, --radius-control
Trigger text--on-background
Value / toggle--on-surface
Popup--shadow-overlay (via rui-popover)
Geometry--size-control-*, --space-control-*