components/listbox
Type Aliases
Section titled “Type Aliases”ListboxItemState
Section titled “ListboxItemState”ListboxItemState =
object
Intrinsic focus and selection state supplied when rendering a Listbox item.
Properties
Section titled “Properties”active
Section titled “active”active:
boolean
disabled
Section titled “disabled”disabled:
boolean
selected
Section titled “selected”selected:
boolean
ListboxProps
Section titled “ListboxProps”ListboxProps<
T,Multiple> > =object&Omit<HTMLAttributes<HTMLDivElement>>,"defaultValue"|"onChange"|"onSelect"|"value"> > &Multipleextendstrue?object:Multipleextendsfalse?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.
Type Declaration
Section titled “Type Declaration”emptyMessage?
Section titled “emptyMessage?”
optionalemptyMessage?:ReactNode
getKey
Section titled “getKey”getKey: (
item) =>string
Returns the stable key used for focus and selection.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”string
getLabel
Section titled “getLabel”getLabel: (
item) =>string
Returns the accessible label used for an item.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”string
isDisabled?
Section titled “isDisabled?”
optionalisDisabled?: (item) =>boolean
Determines whether an item can receive focus or selection.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”boolean
items: readonly
T[]
rootRef?
Section titled “rootRef?”
optionalrootRef?:React.Ref<HTMLDivElement>>
Receives the selection control’s root div.
renderItem?
Section titled “renderItem?”
optionalrenderItem?: (item,active,state) =>ReactNode
Renders an item with its intrinsic focus and selection state.
Parameters
Section titled “Parameters”T
active
Section titled “active”boolean
Returns
Section titled “Returns”ReactNode
Type Parameters
Section titled “Type Parameters”T
Multiple
Section titled “Multiple”Multiple extends boolean = false
ListboxValue
Section titled “ListboxValue”ListboxValue<
Multiple> > =Multipleextendstrue?string[] :null|string
Supported ListboxValue values.
Type Parameters
Section titled “Type Parameters”Multiple
Section titled “Multiple”Multiple extends boolean = false
Functions
Section titled “Functions”Listbox()
Section titled “Listbox()”Listbox<
T>>(input):Element
A selection primitive with caller-owned values and intrinsic keyboard navigation.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”ListboxProps<T, boolean>
Returns
Section titled “Returns”Element