Cajón Design System
Components

Select

Token-driven dropdown built on the WAI-ARIA listbox pattern with full keyboard support.

Behavior

Select follows the WAI-ARIA listbox pattern: a trigger button (aria-haspopup="listbox") opens a focusable role="listbox", with the active option tracked via aria-activedescendant. It is fully keyboard-operable and has no runtime dependencies.

KeyAction
Enter / Space / Open the menu
/ Move between options (skips disabled)
Home / EndJump to first / last enabled option
Enter / SpaceSelect the active option
EscapeClose and restore focus to the trigger

Clicking outside the control closes it. Disabled options are skipped by keyboard navigation and cannot be selected.

Usage

import { Select } from '@cajon-ui/react';

const [period, setPeriod] = useState('year');

<Select
  aria-label="Period"
  options={[
    { value: 'year', label: 'This Year' },
    { value: 'quarter', label: 'This Quarter' },
    { value: 'month', label: 'This Month' },
  ]}
  value={period}
  onChange={setPeriod}
/>

Props

PropTypeDefaultNotes
optionsSelectOption[]{ value, label, disabled? } choices, in display order
valuestringCurrently-selected value (controlled)
onChange(value: string) => voidCalled with the chosen option's value
placeholderstringSelect…Trigger text when nothing is selected
variantpill | outlinedpillTrigger shape
sizesm | mdmdTrigger size
leadingIconReactNodeRendered before the trigger label
fullWidthbooleanfalseStretch to fill the container
disabledbooleanfalseDisable the control
aria-labelstringAccessible label for the trigger + listbox

On this page