Skip to content

components/listbox

ListboxItemState = object

Intrinsic focus and selection state supplied when rendering a Listbox item.

active: boolean

disabled: boolean

selected: boolean


ListboxProps<T, Multiple> > = object & Omit<HTMLAttributes<HTMLDivElement>>, "defaultValue" | "onChange" | "onSelect" | "value"> > & Multiple extends true ? object : Multiple extends false ? object : { defaultValue?: ListboxValue; multiple?: false; onValueChange?: (value, item) => void; value?: ListboxValue; } | { defaultValue?: ListboxValue<true>>; multiple: true; onValueChange?: (value, item) => void; value?: ListboxValue<true>>; }

Props accepted by Listbox.

optional emptyMessage?: ReactNode

getKey: (item) => string

Returns the stable key used for focus and selection.

T

string

getLabel: (item) => string

Returns the accessible label used for an item.

T

string

optional isDisabled?: (item) => boolean

Determines whether an item can receive focus or selection.

T

boolean

items: readonly T[]

optional rootRef?: React.Ref<HTMLDivElement>>

Receives the selection control’s root div.

optional renderItem?: (item, active, state) => ReactNode

Renders an item with its intrinsic focus and selection state.

T

boolean

ListboxItemState

ReactNode

T

Multiple extends boolean = false


ListboxValue<Multiple> > = Multiple extends true ? string[] : null | string

Supported ListboxValue values.

Multiple extends boolean = false

Listbox<T>>(input): Element

A selection primitive with caller-owned values and intrinsic keyboard navigation.

T

ListboxProps<T, boolean>

Element