API reference
components/listbox
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/listbox";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | ListboxItemState | Intrinsic focus and selection state supplied when rendering a Listbox item. |
| type alias | ListboxProps | Props accepted by Listbox. |
| type alias | ListboxValue | Supported ListboxValue values. |
| function | Listbox() | A selection primitive with caller-owned values and intrinsic keyboard navigation. |
ListboxItemStatetype alias
Section titled “ListboxItemState”type 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;ListboxPropstype alias
Section titled “ListboxProps”type 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.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
emptyMessage? |
ReactNode |
- |
getKey() |
(item) => string |
Returns the stable key used for focus and selection. |
getLabel() |
(item) => string |
Returns the accessible label used for an item. |
isDisabled()? |
(item) => boolean |
Determines whether an item can receive focus or selection. |
items |
readonly T[] |
- |
rootRef? |
React.Ref<HTMLDivElement> |
Receives the selection control’s root div. |
renderItem()? |
(item, active, state) => ReactNode |
Renders an item with its intrinsic focus and selection state. |
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T |
- |
Multiple extends boolean |
false |
ListboxValuetype alias
Section titled “ListboxValue”type ListboxValue<Multiple> = Multiple extends true ? string[] : null | string;Supported ListboxValue values.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Multiple extends boolean |
false |
Listbox()function
Section titled “Listbox()”function Listbox<T>(input): Element;A selection primitive with caller-owned values and intrinsic keyboard navigation.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
ListboxProps<T, boolean> |
Returns
Section titled “Returns”Element