Expand description
ComboBox — dropdown selection widget.
Generic over the item type T: Clone + PartialEq + 'static. Selection is
value-based: the bound Signal<Option<T>> survives reorder and insertion
of the backing model. Items come from one of four input paths:
ComboBox::new— static list of localizable strings (the 90% case).ComboBox::from_items— static list of typed values.ComboBox::from_model— reactiveListModel<T>.ComboBox::from_source— externalListDataSource<Item = T>.
The dropdown panel’s node is created during build() and kept dormant, but
its subtree is deferred — built the first time the combo is opened.
§Keyboard
The keys move a highlight through the list, and only a commit changes the value: the W3C ARIA select-only combobox pattern. A reader arrowing to hear the options changes nothing, and an application acting on the value (a language switcher) acts once, on the option the user picked.
Enter/Space: open the list; in the open list, commit the highlighted option and close.ArrowDown/ArrowUp: open the list and move the highlight one item from the value, stopping at the ends; with no value,ArrowDownreaches the first item. Win32’s combo box,QComboBox, GTK and the W3C ARIA listbox pattern all stop rather than wrap; a combo box is a value, and wrapping is the menu convention.Alt+ArrowDown/Alt+ArrowUp: open the list on the value (or the first item) without moving, and close it. The Win32 / WinForms / WPF chord and the ARIA combobox pattern.F4: toggle the list (Win32 / Qt / WPF).Escape: close the list and keep the value.Home/End: first / last item.PageUp/PageDown: one page, where a page ismax_visible_itemsrows.- Printable characters: type-ahead, within
type_ahead_timeout. - A chord holding
Ctrl,AltorSuperis not the combo box’s and falls through to the application;Shiftis, so a capital letter still types.
Every key that moves the highlight opens the list first when it is
closed, so the reader hears the option it reaches. Focus stays on the
combo box (or, in a searchable list, on its
search field), which names the highlighted option as its
active_descendant: every platform adapter follows that as the focus.
The widget is split across four internal modules:
stateholds theItemSourceaccessor, the defaultmax_visible_itemsconstant, and the index helpers.itemholds the single-rowDropdownItemwidget.panelholds theDropdownPaneloverlay content and theFilteredItemListinner widget.testsholds the headless unit tests.
§Touch and pen
The closed box is one target — the arrow column is paint inside it, not a second target — and it opens the dropdown from its tap, so already on the release. The field’s hover tint is decoration with nothing behind it.
The dropdown’s rows are menu rows and take the menu row’s target floor at every
density; before this they measured against the raw Compact constant while a
MenuList’s rows grew, and the panel that shows max_visible_items of them now
resolves the same number they do.
Structs§
- Combo
Box - A dropdown selection widget.
Enums§
- Combo
BoxVariant - Tier-1 design-language variant for a combo box trigger. Mirrors the
TextInputVariantshape because both controls live in the same “form-field” visual family — apps that ship a Material 3 theme typically want filled triggers for both, etc.