"use client";
import { ListBox } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
options (required) | readonly PixxlItem[] | — | Options to choose from. |
defaultValue | string | null | — | Initial value when uncontrolled. |
onAction | (id: string) => void | — | Called with the activated option id on every click / Enter / Space. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
selectionFollowsFocus | boolean | false | Single selection only: arrow keys also select (default false — arrows move the active option, Space/Enter select). |
selectionMode | "single" | single | single (default). multiple: aria-multiselectable, Shift/Ctrl range keys. none: options are actions (no aria-selected). |
value | string | null | — | Selected option id (controlled); null for none. |
optionsrequiredreadonly PixxlItem[]
Options to choose from.
defaultValuestring | null
Initial value when uncontrolled.
onAction(id: string) => void
Called with the activated option id on every click / Enter / Space.
onValueChange(value: string) => void
Called with the new value (only when it changes).
selectionFollowsFocusdefault falseboolean
Single selection only: arrow keys also select (default false — arrows move the active option, Space/Enter select).
selectionModedefault single"single"
single (default). multiple: aria-multiselectable, Shift/Ctrl range keys. none: options are actions (no aria-selected).
valuestring | null
Selected option id (controlled); null for none.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const items = [
{ id: "candraw", label: "candraw" },
{ id: "cantext", label: "cantext" },
];
<ListBox aria-label="Package" options={items} />