List Box
Choose one item from a visible list.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/list-boxComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/inputField is installed with Input.
Usage
import { ListBox, ListBoxItem } from "@/siteplane/components/list-box";
<ListBox aria-label="Workspace">
<ListBoxItem value="design">Design</ListBoxItem>
</ListBox>;Composition
ListBox
└── ListBoxItemControlled selection
Control the selection with value and onValueChange; both use the item’s string value, not React Aria selectedKeys. Name the list with a visible FieldLabel and point aria-labelledby at it; disabled items stay visible but can’t be selected.
Row selection
Both appearances fill the selected row. The default, check, also shows a check that draws in when a row is selected and out when another row is picked, the way the Checkbox check does, and appears instantly under reduced motion. Set selectionAppearance="row" to drop the check, so the fill alone marks the selected row.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
List | string | uncontrolled / unset | Selected item value. |
List | (value: string) => void | unset | Reports the next non-empty selection. |
List | ListBoxSelectionAppearance: check | row | check | Selected-item treatment. |
List | sm | md | lg | xl | provider / lg | Shared item size. |
List | string | required | Stable item identity. |
List | string | derived from children | Plain text for typeahead and rich options. |
List | boolean | false | Prevents selection. |
List | boolean | true | Allows wrapped content. |
List | string | list-box-item | Slot override. |
ListBoxProps extends native div props excluding role, aria-orientation and defaultValue. Its React Aria implementation fixes vertical orientation, single selection, replace behavior, disallowEmptySelection and focus wrapping. It does not expose multiple selection, selectedKeys or onSelectionChange. ListBoxItemProps extends ButtonBaseProps but omits align, aria-disabled, aria-selected, onClick, onKeyDown, role, render, size, tabIndex, value, variant and width; its own value is a required string. Item must be inside ListBox. The root owns selection and the item supplies its own ghost Button/React Aria composition. Both accept string className.
Usage notes
Arrow keys navigate the vertical list and typing uses text derived recursively from each item’s children. Give the list an accessible name. For rich items, supply ListBoxItem.textValue so typeahead matches only the option title. This component does not submit a native form value; serialize selected state yourself.