Skip to content
Alea0.1

Forms

Select

Pick one option from a list in a popover, with descriptions, icons, sections and disabled options.

Ant Design: Select

import { Select, SelectItem, SelectSection } from '@alea/ui';

Examples

Select

Options from a list of objects.

Export as

Descriptions and icons

Options can carry a description and an icon.

Theme

Sections and validation

Group options; mark it required.

FontUsed for headings.

Props

Select props

Pick one option from a list in a popover; type to jump, arrows to move.

PropTypeDefaultDescription
descriptionReactNode-Help text under the field.
errorMessageReactNode | ((v: ValidationResult) => ReactNode)-Error text, shown when invalid.
itemsIterable<T>-The options. For sections, nest SelectSection and SelectItem as children instead.
labelReactNode-The visible label.
size"sm" | "md" | "lg"'md'sm 32 px, md 44 px (default), lg 48 px.

SelectItem props

An option in a Select (or any listbox).

PropTypeDefaultDescription
descriptionReactNode-A second line under the option.
iconReactNode-An icon before the option.

SelectSection props

A titled group of options.

PropTypeDefaultDescription
titlerequiredReactNode-The section heading.

Accessibility

  • The trigger is a button with the label and value; the list is a listbox.
  • Typing jumps to matching options.
  • A hidden native select keeps it working in forms and autofill.

Keyboard

KeyDoes
Enter, Space, Arrow DownOpens the list
Arrow keysMove between options
EnterPicks the focused option
EscapeCloses without changing
LettersJump to an option

Do and don't

Do

  • Sort options in a way people expect (alphabetical, by frequency).

Don't

  • Don't use for two or three options: show them as Radio or SegmentedControl.

In Figma

Select trigger set (Size × State) and a Listbox with Option variants.

Tested with axe, keyboard and screen reader roles