Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. Forms
  4. ListBox

Forms

ListBox

A list of options people pick from, shown in the page instead of a popup: single or multiple selection, sections, descriptions and icons, a check at either side, type to jump, scrolling inside a height.

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

Examples

ListBox

Options in the page: single selection with descriptions and icons. Arrows move, typing jumps.

LightBright surfaces
DarkEasy on the eyes at night
SystemFollows your device

Multiple, sections and plain

selectionMode="multiple" with the check at the start, sections with headings, and the plain look inside your own container with a scrolling height.

Name
Email
Phone
Organization
Role
Argentina
Brazil
Chile
Colombia
Ecuador
Mexico
Peru
Spain
Uruguay
Venezuela

Configurations

Every value of every property, side by side. Numbers match the legend below.

start
end
plain
card
horizontal
vertical
  1. Check PositioncheckPosition
  2. Variantvariant
  3. Orientationorientation

States

Each interaction state, forced so you can compare them, in both themes.

Dark

Enabled
Hover
Focus
Pressed

Light

Enabled
Hover
Focus
Pressed

Anatomy

The parts of the component and the class that styles each one.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-accent-subtle…
  • --alea-border…
  • --alea-focus…
  • --alea-surface…
  • --alea-text-muted…

Radius

  • --alea-radius-md…

Type

  • --alea-font-size-sm…

Props

ListBox props

A list of options people pick from, on its own (not in a popup): settings, filters, side lists. Single or multiple selection, sections, descriptions and icons, type to jump.

PropTypeDefaultDescription
checkPosition"start" | "end"'end'Where the selected check shows: end (default) or start.
emptyTextReactNode-What shows when the list is empty.
itemsIterable<T>-The options as data, or SelectItem and SelectSection children.
maxHeightstring | number-Scrolls inside this height.
variant"plain" | "card"'card'Draws the list as a card with a border (default), or plain inside your own container.

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.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

ListBox

Variants
checkPositionstartend
variantplaincard
States
Keyboard focusSelected
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-listbox-empty.alea-listbox-standalone
Data attributes
data-variant=card

SelectItem

Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-option-icon.alea-option-text.alea-option-desc.alea-option-check
Data attributes
data-check=startdata-on

SelectSection

Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-option-section.alea-option-header

Accessibility

  • A listbox: arrows move, Space or Enter selects, typing jumps to the option that starts with those letters.
  • Selected options are announced as selected; disabled ones are skipped.
  • Give it a visible label with aria-labelledby, or an aria-label.

Keyboard

KeyDoes
Arrow Up / DownMove
Space or EnterSelect
Shift + ArrowExtend the selection (multiple)
⌘A / Ctrl+ASelect all (multiple)
Home / EndFirst or last option
Type lettersJump to a match

Do and don't

Do

  • Use it when the options should stay visible: settings, a side filter, a short list.

Don't

  • Don't use it for navigation: use links.
  • Don't put long lists in it without maxHeight or a search.
Tested with axe, keyboard and screen reader roles