Zephora UI

Data

ListBox

Selectable list following the WAI-ARIA listbox pattern with single, multiple or no selection and roving-tabindex keyboard navigation.

Import

import { ListBox, ListBoxItem } from "@zephora/react";

Examples

Single selection

  • JavaScript
  • TypeScript
  • Rust

Multiple with descriptions

In `selectionMode="multiple"` the callback fires with a `string[]`. Disabled items are skipped by keyboard navigation.

  • EmailDaily digest at 9:00
  • PushInstant on your devices
  • SMSRequires a verified number
Selected: email

API

ListBox props

PropTypeDefaultDescription
selectionMode"none" | "single" | "multiple""single"Selection behavior; "none" renders a plain list.
valuestring | string[] | nullControlled value: `string | null` (single) or `string[]` (multiple).
defaultValuestring | string[] | nullUncontrolled initial value.
onValueChange(value: string | string[] | null) => voidFires with `string | null` (single) or `string[]` (multiple).
unstyledbooleanfalseHeadless mode — skips Zephora styling.

ListBoxItem props

PropTypeDefaultDescription
value *stringUnique option value.
disabledbooleanfalseRemoves the option from selection and keyboard navigation.
descriptionReactNodeSecondary line rendered under the label.
unstyledbooleanHeadless mode — inherits from the parent ListBox by default.

Keyboard

KeyAction
ArrowDown / ArrowUpMove focus to the next / previous enabled option.
Home / EndMove focus to the first / last enabled option.
Enter / SpaceSelect the focused option (toggles in multiple mode).
TabMoves focus into / out of the list (roving tabindex).