Dropdowns demos
Every demo has a standalone page with its preview, source and notes.
31 demos
Listbox
- Listbox basics
A single-selection Listbox where selection follows focus, and a multiple-selection Listbox with checkboxes, a tri-state select all, a five-item limit and a disabled item.
- Listbox grid layout
A selectable list whose rows hold their own buttons, and a four-column tile gallery, both on the APG Grid pattern of Listbox layout="grid".
- Listbox data shapes and options
A primitive array, nested objects read through accessors, unique values behind equal labels, a checkbox at the inline end, a fixed height and per-option props.
- Listbox search and grouping
10,000 grouped items in a virtual list with a sticky group header, an accent-insensitive contains search with highlighted matches and a search-change callback.
- Listbox over a remote source
A Listbox reading 5,000 customers from a remote source in ranges as it scrolls, with a base query, a debounced multi-field search, a minimum search length, case matching, aborted superseded reads and a load error with retry.
- Dual list
Two reorderable Listboxes in one drag group with move selected, move all, move up and move down buttons built on moveItems and reorderItems; Alt+Up / Alt+Down reorder from the keyboard.
Components
- Select basics
A controlled Select with a clear button, a searchable Select with accent folding and highlighted matches, and a required form field.
- Select events and methods
onValueChange and onOpenChange with their reason and source, a change vetoed by a controlled value, a controlled open state, focus through the ref, the loading state, the placeholder and the full-screen sheet popup.
- Control sizes
Select, Combobox, TreeSelect, DatePicker and TimePicker at the sm, md and lg sizes, 24, 32 and 40 pixels tall, next to a Button of the same size.
- Combobox basics
An editable combobox with inline autofill, a creatable combobox, and typing MultiSelect chips that add typed text on blur.
- Combobox input, keys and custom values
A controlled input text with onInputChange, custom values validated by onCreateItem, the optional dropdown button, the editable-combobox keys and IME-safe filtering.
- Mention
A textarea with @ people and # tags - suggestions at the caret, keyboard selection, highlighted matches, a disabled person and accent-insensitive search.
- Mention with remote suggestions
An input whose @ suggestions come from a remote source with latency - debounced reads, aborted superseded requests and a loading state.
- Mention options
Trigger detection after whitespace only, multi-word search, a minimum search length, a custom inserted text that keeps native undo, the field ARIA while the list is open and IME-safe detection.
- Mention in rich text
Mention chips in a plain contenteditable element through createContentEditableMentionTarget, and in RichTextEditor through its mentions prop.
- TreeSelect basics
A controlled single TreeSelect where only leaves are selectable, a searchable flat-data TreeSelect whose matches keep their ancestors, and a required form field.
- TreeSelect lazy loading
Folders load on first expand through loadChildren with an abort signal; one share fails first and shows a custom error row with Retry, plus header, footer and item templates.
Recipes
- Select multiple
MultiSelect CheckBox mode with select all and group selection, a selection limit with a custom separator, and a count summary over 10,000 items.
- Select multiple options and keys
An array value shown as delimited text, select all from the list and from code, hidden selected options, closing on select, click to open, the multiple-selection keys and ARIA.
- AutoComplete
A free-text Combobox with suggestions from the first character, contains matching, five results and highlighted matches.
- AutoComplete with remote suggestions
A free-text Combobox over a remote source, with the optional popup button, the suggestion keys, aria-busy while loading, a custom option template and announced result counts.
- Combobox multiple tags
Typing MultiSelect with custom tags validated by onCreateItem, chip templates and per-chip styles, remove buttons, chip keyboard navigation, the optional dropdown button and changes vetoed by a controlled value.
- MultiColumn ComboBox
A Combobox whose popup is a grid with sortable headers, aligned, formatted and checkbox columns over 5,000 rows, searched by name and city.
- MultiColumn ComboBox templates and remote rows
Cell and header templates, per-cell props, a taller fixed row height, a reactive initial sort, row keyboard navigation with grid ARIA, and range reads over 100,000 remote rows.
- TreeSelect checkboxes
Multiple TreeSelect with tri-state checkboxes, cascade or independent checks, Select all, and the text, chips and count value displays.
Guides
- Dropdown templates
Custom options, value, group headers, popup header and footer, and the empty, loading and error states of Select and Combobox.
- Popup, type-ahead and remote labels
Option icons, popup height and width, type-ahead over a 10,000-item virtual list, typing to filter, remote values labelled without opening the popup, right-to-left placement and the dismissal rules.
- Dropdown forms and appearance
A form with a placeholder, read-only and disabled fields, DOM attributes, submission and reset; styling through className, part maps and a theme seed; localized texts with plural counts; and a right-to-left chip field.
- Select and Combobox labels
A Select and a Combobox labelled, described and marked invalid through their own label, description and errorMessage props, without a wrapping Field or a hand-written label element.
- Dropdown accessibility
A Select, a Combobox with chips and a Listbox with selected, active and disabled options for keyboard, screen reader, forced-colors, touch and server-rendering checks.
- Dropdowns over 100,000 items
Select, Combobox, Select multiple with select all and the Combobox columns popup over 100,000 local items, plus twenty closed Selects sharing the same data.