Skip to contents

Listbox

An always-visible list for selecting one or more options.

Playlist
Pop
Billie JeanMichael Jackson
Dancing QueenABBA
Like a PrayerMadonna
Bohemian RhapsodyQueen
Rock
Hotel CaliforniaEagles
Stairway to HeavenLed Zeppelin
Smells Like Teen SpiritNirvana
Back in BlackAC/DC

Usage guidelines

  • Always visible: Unlike Select, the Listbox is always open and does not use a popup or trigger. Use it when all options should be visible at once.
  • Multi-select support: Set selectionMode="multiple" or "explicit-multiple" to allow selecting more than one item.
  • Form controls must have an accessible name: Prefer <Listbox.Label>, or provide an aria-label on <Listbox.List> when no visible label is rendered. See the forms guide.

Anatomy

Import the component and assemble its parts:

Anatomy

Examples

Selection modes

The selectionMode prop controls how items are selected:

  • "single" (default) — clicking an item selects it and deselects any other.
  • "multiple" — every click toggles an item. Hold Shift and click to select a contiguous range.
  • "explicit-multiple" — clicking an item replaces the selection. Hold Ctrl/ and click to toggle, or Shift and click to select a range.
multiple
Bohemian RhapsodyQueen
Billie JeanMichael Jackson
Hotel CaliforniaEagles
SuperstitionStevie Wonder
Dancing QueenABBA
explicit-multiple
Bohemian RhapsodyQueen
Billie JeanMichael Jackson
Hotel CaliforniaEagles
SuperstitionStevie Wonder
Dancing QueenABBA

Lazy loading

Use Listbox.LoadingTrigger as a sentinel at the end of the list. When it scrolls into view, the onLoadMore callback fires.

Library
Bohemian Rhapsody
Billie Jean
Hotel California
Stairway to Heaven
Imagine
Smells Like Teen Spirit
Like a Rolling Stone
Hey Jude
Superstition
What's Going On
Scroll for more

Drag and drop

Wrap reorderable content in Listbox.DragAndDropProvider and provide onItemsReorder on the provider. Use the provider’s canDrag and canDrop predicates to control which items can be dragged or dropped, and use Listbox.ItemDragHandle to restrict drag initiation to a handle. Items can also be reordered with the keyboard using Alt + Arrow keys.

Use canDrop to constrain reordering within a Listbox.Group or apply other custom drop rules.

In multiple or explicit-multiple mode, dragging a selected item moves all selected items together, preserving their relative order.

Queue
Bohemian RhapsodyQueen
Billie JeanMichael Jackson
Hotel CaliforniaEagles
SuperstitionStevie Wonder
Dancing QueenABBA

Drag within groups

Pass canDrop to Listbox.DragAndDropProvider to keep reordering inside the current Listbox.Group. This example only accepts drops when every dragged item belongs to the same group as the target item.

The same canDrop callback can also enforce other drop target rules, such as preventing drops around locked items or only allowing certain item types to be reordered next to each other. Because it receives the dragged items, the target item, and the drop edge, you can use it to express custom placement logic in one place.

Playlist
Pop
Billie JeanMichael Jackson
Dancing QueenABBA
Like a PrayerMadonna
Rock
Hotel CaliforniaEagles
Smells Like Teen SpiritNirvana
Back in BlackAC/DC

Custom keyboard shortcuts

You can add custom keyboard shortcuts by handling onKeyDown on Listbox.List and updating the items array directly. This example uses ] and [ to move the focused item to the beginning or the end of the list.

Layers
Header
Hero image
Body text
Call to action
Background

API reference

Root

Groups all parts of the listbox. Doesn’t render its own HTML element.

namestring
Name
Description

Identifies the field when a form is submitted.

Type
defaultValueValue[]
Description

The uncontrolled value of the listbox when it’s initially rendered.

To render a controlled listbox, use the value prop instead.

Type
valueValue[]
Name
Description

The value of the listbox. Use when controlled. Always an array.

Type
onValueChangefunction
Description

Event handler called when the value of the listbox changes.

Type
highlightItemOnHoverbooleantrue
Description

Whether moving the pointer over items should highlight them.

Type
Default
true
actionsRefReact.Ref<Listbox.Root.Actions<Value>>
Description

A ref to imperative actions.

Type
isItemEqualToValuefunction
Description

Custom comparison logic used to determine if a listbox item value matches the current selected value. Defaults to Object.is comparison.

Type
itemToStringLabelfunction
Description

Converts an object value to a string label for display.

Type
itemToStringValuefunction
Description

Converts an object value to a string representation for form submission.

Type
loadingbooleanfalse
Description

Whether items are currently being loaded.

Type
Default
false
loopFocusbooleantrue
Description

Whether keyboard navigation loops back to the first/last item.

Type
Default
true
onHighlightChangefunction
Description

Event handler called when the highlighted item changes. Receives the highlighted item’s value and DOM element, or null for both when no item is highlighted.

Type
onLoadMorefunction
Description

Event handler called when more items should be loaded.

Type
selectionModeSelectionMode'single'
Description

Determines how user interactions affect the selection.

  • 'single' — Only one item can be selected at a time.
  • 'multiple' — Clicking toggles items. Shift+Click selects a range.
  • 'explicit-multiple' — Like a file browser: plain click replaces the selection, Ctrl/Cmd+Click toggles, Shift+Click selects a range.
Type
Default
'single'
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
requiredbooleanfalse
Description

Whether the user must choose a value before submitting a form.

Type
Default
false
orientation'vertical' | 'horizontal''vertical'
Description

The orientation of the listbox for keyboard navigation.

Type
Default
'vertical'
inputRefReact.Ref<HTMLInputElement>
Description

A ref to access the hidden input element.

Type
idstring
Name
Description

The id of the Listbox.

Type
childrenReact.ReactNode
Type

Listbox.Root.PropsHide

Re-Export of Root props as ListboxRootProps

Listbox.Root.StateHide

Listbox.Root.ActionsHide

Listbox.Root.ChangeEventReasonHide

Listbox.Root.ChangeEventDetailsHide

Label

An accessible label that is automatically associated with the listbox. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.Label.PropsHide

Re-Export of Label props as ListboxLabelProps

Listbox.Label.StateHide

List

A container for the listbox items. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation

Indicates the orientation of the listbox.

data-disabled

Present when the listbox is disabled.

Attribute
Description
data-orientation

Indicates the orientation of the listbox.

data-disabled

Present when the listbox is disabled.

Listbox.List.PropsHide

Re-Export of List props as ListboxListProps

Listbox.List.StateHide

DragAndDropProvider

Enables drag-and-drop reordering when rendered inside Listbox.Root. Renders no DOM element of its own.

canDragfunction
Description

Determines whether a given item can initiate drag-and-drop. Defaults to allowing all non-disabled items.

Type
canDropfunction
Description

Determines whether the dragged items can be dropped relative to a target item. Defaults to allowing all drops.

Type
onItemsReorderfunction
Description

Event handler called when items are reordered via drag-and-drop or keyboard. items contains the moved item(s). referenceItem is the item that was dropped on or moved next to, and edge indicates placement relative to it.

Type
childrenReact.ReactNode
Type

Listbox.DragAndDropProvider.PropsHide

Re-Export of DragAndDropProvider props as ListboxDragAndDropProviderProps

Listbox.DragAndDropProvider.StateHide

Item

An individual option in the listbox. Renders a <div> element.

labelstring
Name
Description

Specifies the text label to use when the item is matched during keyboard text navigation.

Type
valueanynull
Name
Description

A unique value that identifies this listbox item.

Type
Default
null
nativeButtonbooleanfalse
Description

Whether the component renders a native <button> element when replacing it via the render prop. Set to true if the rendered element is a native button.

Type
Default
false
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
childrenReact.ReactNode
Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-selected

Present when the listbox item is selected.

data-highlighted

Present when the listbox item is highlighted.

data-dragging

Present when the listbox item is being dragged.

data-disabled

Present when the listbox item is disabled.

data-drop-target

Present when the listbox item is a drop target.

data-drop-target-edge

Indicates the closest edge when the item is a drop target. The value is 'before' or 'after'.

Attribute
Description
data-selected

Present when the listbox item is selected.

data-highlighted

Present when the listbox item is highlighted.

data-dragging

Present when the listbox item is being dragged.

data-disabled

Present when the listbox item is disabled.

data-drop-target

Present when the listbox item is a drop target.

data-drop-target-edge

Indicates the closest edge when the item is a drop target. The value is 'before' or 'after'.

Listbox.Item.PropsHide

Re-Export of Item props as ListboxItemProps

Listbox.Item.StateHide

ItemText

A text label of the listbox item. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.ItemText.PropsHide

Re-Export of ItemText props as ListboxItemTextProps

Listbox.ItemText.StateHide

ItemIndicator

Indicates whether the listbox item is selected. Renders a <span> element.

childrenReact.ReactNode
Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
keepMountedboolean
Description

Whether to keep the HTML element in the DOM when the item is not selected.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.ItemIndicator.PropsHide

Re-Export of ItemIndicator props as ListboxItemIndicatorProps

Listbox.ItemIndicator.StateHide

ItemDragHandle

A drag handle within a listbox item for initiating drag-and-drop reordering. Renders a <div> element.

When placed inside a Listbox.Item within Listbox.DragAndDropProvider, the drag operation will be restricted to start only from this handle whenever the provider allows dragging for that item.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.ItemDragHandle.PropsHide

Re-Export of ItemDragHandle props as ListboxItemDragHandleProps

Listbox.ItemDragHandle.StateHide

Group

Groups related listbox items with the corresponding label. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.Group.PropsHide

Re-Export of Group props as ListboxGroupProps

Listbox.Group.StateHide

GroupLabel

An accessible label that is automatically associated with its parent group. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.GroupLabel.PropsHide

Re-Export of GroupLabel props as ListboxGroupLabelProps

Listbox.GroupLabel.StateHide

LoadingTrigger

A sentinel element that triggers loading more items when scrolled into view. Renders a <div> element.

Place at the end of the listbox items. When it becomes visible in the scrollable list container, the onLoadMore callback on Listbox.Root is called.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
keepMountedboolean
Description

Whether to keep the HTML element in the DOM when not loading.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Listbox.LoadingTrigger.PropsHide

Re-Export of LoadingTrigger props as ListboxLoadingTriggerProps

Listbox.LoadingTrigger.StateHide