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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQAumujy5kXaOKurr6zgTP2krHrFVXi2kj8seRYrlvq2GssUjReh5MiVpQbLFQNy9HsmcasqpBNVsXytWTw0ZDjA=

Listbox

import { Listbox } from '@dxos/react-ui-list';
Terminal window
npm install @dxos/react-ui-list

Listbox is a flat list the user picks one row from. It is the core Listbox with a simpler selection:

  • With value and onValueChange, the user picks one row.
  • Without them, the list is only for display.

Listbox.Root takes one value where the core root takes an array, and Listbox.Item takes an option’s id where the core item takes the option. The other parts are the core parts.

Use this Listbox when the user picks at most one row. Use the core one when the user selects several rows.

Each part handles keyboard navigation and the current and selected states. Each part also sets its own spacing, so put the list in a panel’s body with no padding around it.

Part What it is
Listbox.Root The root, which takes the options as items. value, onValueChange and onDeselect make the list selectable
Listbox.Label The list’s name
Listbox.Viewport A scroll area, for a list that scrolls by itself
Listbox.Content The list element
Listbox.Item One row, for the option whose value is id
Listbox.ItemIcon The row’s icon
Listbox.ItemText The row’s label. The option’s label by default
Listbox.ItemDescription A second line under the label. The option’s description by default
Listbox.ItemIndicator The check shown while the row is selected
Listbox.ItemGroup A group of rows
Listbox.ItemGroupLabel The group’s name
Listbox.Empty The placeholder shown while there are no items

Each option has a value, a label and an optional description. Inside each Listbox.Item, the parts read the option, so Listbox.ItemText shows the option’s label without being told.

Example (Picking a person)

import {
function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)

Returns a stateful value, and a function to update it.

@version ― 16.8.0

@see ― https://react.dev/reference/react/useState

useState
} from 'react';
import {
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
} from '@dxos/react-ui-list';
/** One row per option; selecting a row reports its value. */
export const
const PeopleListbox: () => React.JSX.Element

One row per option; selecting a row reports its value.

PeopleListbox
= () => {
const [
const selected: string
selected
,
const setSelected: React.Dispatch<React.SetStateAction<string>>
setSelected
] =
useState<string>(initialState: string | (() => string)): [string, React.Dispatch<React.SetStateAction<string>>] (+1 overload)

Returns a stateful value, and a function to update it.

@version ― 16.8.0

@see ― https://react.dev/reference/react/useState

useState
<string>('ada');
return (
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>
Root
items: readonly ListboxOption[]
items
={
const PEOPLE: {
value: string;
label: string;
description: string;
}[]
PEOPLE
}
value?: string | undefined

Selected option id (controlled). Supplying any of value/defaultValue/onValueChange makes the list single-selection; omitting all three selects nothing (selectionMode='none'), keeping zag's navigation. Multiple selection, or a useListSelection-shaped value, goes through listboxSelection on Listbox.Root.

value
={
const selected: string
selected
}
onValueChange?: ((value: string) => void) | undefined
onValueChange
={
const setSelected: React.Dispatch<React.SetStateAction<string>>
setSelected
}>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Label: React.ForwardRefExoticComponent<Omit<ListboxLabelProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLLabelElement>>
Label
>People</
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Label: React.ForwardRefExoticComponent<Omit<ListboxLabelProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLLabelElement>>
Label
>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
children: React.ReactNode;
} & React.RefAttributes<HTMLDivElement>>
Viewport
>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Content: React.ForwardRefExoticComponent<Omit<ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
Content
>
{
const PEOPLE: {
value: string;
label: string;
description: string;
}[]
PEOPLE
.
Array<{ value: string; label: string; description: string; }>.map<React.JSX.Element>(callbackfn: (value: {
value: string;
label: string;
description: string;
}, index: number, array: {
value: string;
label: string;
description: string;
}[]) => React.JSX.Element, thisArg?: any): React.JSX.Element[]

Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param ― callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param ― thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

map
((
person: {
value: string;
label: string;
description: string;
}
person
) => (
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
item: ListboxOption;
current?: boolean;
highlightOnHover?: boolean;
children?: React.ReactNode;
} & React.RefAttributes<HTMLDivElement>, "ref">, "item"> & {
id: string;
} & React.RefAttributes<HTMLDivElement>>
Item
Attributes.key?: React.Key | null | undefined
key
={
person: {
value: string;
label: string;
description: string;
}
person
.
value: string
value
}
id: string

The option's value; the option itself comes from Root's items.

id
={
person: {
value: string;
label: string;
description: string;
}
person
.
value: string
value
}>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type ItemIcon: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & Partial<Pick<IconProps, "label" | "hue" | "icon" | "valence">> & React.RefAttributes<HTMLDivElement>>
ItemIcon
icon?: string | undefined
icon
='ph--user--regular' />
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type ItemText: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
tone?: "default" | "muted";
} & React.RefAttributes<HTMLParagraphElement>>
ItemText
/>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type ItemDescription: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLParagraphElement>>
ItemDescription
/>
<
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type ItemIndicator: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLDivElement>>
ItemIndicator
/>
</
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
item: ListboxOption;
current?: boolean;
highlightOnHover?: boolean;
children?: React.ReactNode;
} & React.RefAttributes<HTMLDivElement>, "ref">, "item"> & {
id: string;
} & React.RefAttributes<HTMLDivElement>>
Item
>
))}
</
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Content: React.ForwardRefExoticComponent<Omit<ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
Content
>
</
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
children: React.ReactNode;
} & React.RefAttributes<HTMLDivElement>>
Viewport
>
</
const Listbox: {
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>;
... 10 more ...;
ItemGroupLabel: React.ForwardRefExoticComponent<...>;
}

Selectable or plain list on Next parts, with Listbox's part names. Wrap Content in a Viewport for a list that scrolls itself; leave it bare inside a host that scrolls (such as a ScrollArea composed in Panel.Body). The current ItemContent becomes a row composed from ItemIcon, ItemText, ItemDescription and trailing controls. Annotated so the declaration names Next's parts through Next rather than react-ui's modules.

Listbox
.
type Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "defaultValue" | "onSelect">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
items: readonly ListboxOption[];
selectionMode?: ListboxSelectionMode;
value?: string[];
defaultValue?: string[];
onValueChange?: (value: string[]) => void;
highlightedValue?: string | null;
... 9 more ...;
size?: Size;
} & React.RefAttributes<...>, "ref">, "defaultValue" | ... 2 more ... | "onValueChange"> & {
...;
} & React.RefAttributes<...>>
Root
>
);
};

Listbox.Item gets only the option’s value, as its id. Listbox.ItemText and Listbox.ItemDescription take no props, and onValueChange keeps the picked value in state.