Skip to content
SENVENLI UI

List box

A list of options shown in place, not in a dropdown: pick one or several.
One choice, in place
import { ListBox } from "@senvenli/react/selection";

Examples

Several

`selectionMode="multiple"`: Space toggles an option.

Guidelines

When to use it

  • A short set of options that should stay visible: a settings choice, a filter list.

Use something else when

  • The choice can live in a dropdown. Select
  • Rows of content with their own actions. Grid list
  • Two to five options with a line of detail. Radio group

Do and avoid

  • Label it; keep options short.

Accessibility

Built in

  • Arrows move, typing jumps to an option, Space selects; selected options are marked and say so.

You provide

  • A label (or aria-label).

API reference

ListBox

label
React.ReactNode

The visible name of the list. Leave it out only with an aria-label.

aria-label
string
itemsRequired
readonly ListBoxOption[]
selectionMode
"none" | "single" | "multiple"Default "single"

single (default), multiple or none (a list of actions with onAction).

selectedKeys
Iterable<Key>
defaultSelectedKeys
Iterable<Key>
onSelectionChange
(keys: Selection) => void
onAction
(key: Key) => void

With selectionMode="none": what pressing an option does.

emptyState
React.ReactNode

Shown inside the list when it has no options: a sentence or an EmptyState.