apps/www/content/docs/components/listbox.mdx
import { Listbox } from "@chakra-ui/react"
<Listbox.Root>
<Listbox.Label />
<Listbox.Content>
<Listbox.Item>
<Listbox.ItemText />
<Listbox.ItemIndicator />
</Listbox.Item>
</Listbox.Content>
</Listbox.Root>
To setup the listbox, use useListCollection to manage the
list collection.
Control the listbox value externally using the value and onValueChange props
for custom state management.
An alternative way to control the listbox is to use the RootProvider component
and the useListbox store hook.
This way you can access the listbox state and methods from outside the listbox.
<ExampleTabs name="listbox-with-store" />Use
RootProvider + useListboxorRoot, not both.
Disable specific items in the listbox to indicate unavailable options while keeping them visible for context.
<ExampleTabs name="listbox-disabled-item" />Use item groups to organize related options with clear section headers, making it easier for users to find specific categories of items.
<ExampleTabs name="listbox-grouped" />Display listbox items in a horizontal layout with card-based presentation, perfect for media galleries or visual selection interfaces.
<ExampleTabs name="listbox-horizontal" />Enable users to select multiple items from the list, useful for scenarios like choosing tags, categories, or preferences.
<ExampleTabs name="listbox-multiselect" />Provide convenient "Select All" and "Select None" controls for multiple selection scenarios, with visual indicators showing selection state.
<ExampleTabs name="listbox-select-all" />Use extended selection mode to allow users to select multiple items using keyboard shortcuts like Cmd/Ctrl for advanced selection patterns.
<ExampleTabs name="listbox-extended-select" />Display custom checkmarks for multiple selection scenarios, providing clear visual feedback for selected items.
<ExampleTabs name="listbox-with-checkmark" />Add icons to listbox items to provide visual context and improve recognition of different options.
<ExampleTabs name="listbox-with-icon" />Include additional descriptive text for each item to provide more context and help users make informed choices.
<ExampleTabs name="listbox-with-description" />Combine a search input with the listbox to filter options dynamically, making it easy to find specific items in long lists.
<ExampleTabs name="listbox-with-input" />Use the listbox within a popover to create dropdown-like selection menus that overlay other content without taking up permanent screen space.
<ExampleTabs name="listbox-with-popover" />Present the listbox in a modal dialog for focused selection experiences, particularly useful for important choices that need user attention.
<ExampleTabs name="listbox-with-dialog" />Handle large datasets efficiently with virtualization, rendering only visible items to maintain smooth scrolling performance even with thousands of items.
<ExampleTabs name="listbox-virtualized" />Create an interactive gallery where the listbox acts as navigation for displaying different images or media content.
<ExampleTabs name="listbox-image-explorer" />Create a dual-listbox interface for moving items between available and selected states, commonly used for permission management or item selection workflows.
<ExampleTabs name="listbox-transfer-list" />Display emojis in a grid layout with filtering capability, perfect for emoji pickers or icon selection interfaces.
<ExampleTabs name="listbox-with-emoji-grid" />Explore the Listbox component parts interactively. Click on parts in the
sidebar to highlight them in the preview.