GPUI Deck

Select

Single selection with replaceable options, buffered typeahead, Home/End and arrow navigation, disabled options, commit, and focus.

Rendered by GPUI’s web backend from the real component. Requires a browser with WebGPU.

Open the time-zone list and press Home, End, an arrow key or the first letters of a city. The list scrolls the highlighted option into view. Enter commits it. Wheel scrolling lets you inspect other options. Short lists use their natural height; Select::list_max_height(px(144.)) sets a smaller limit within the window.

Choose Show Asia only to narrow the list. Seoul remains selected, while a selected city outside Asia is cleared. The native recording example uses the same API to enable the Laser tool for the Presentation preset.

SelectState::new(items, cx) owns an ordered set of unique values, one committed value and a separate open-popup cursor. Disabled options are skipped. Observe the state for presentation and subscribe to SelectEvent::Change for committed user changes. set_selected_value(Some(value), window, cx) sets an enabled value; None clears it. Accepted updates close the popup without a user event, using its normal focus restoration. Unknown/disabled values return false without changing the value, pending cursor or popup. App updates remain available while the whole control is disabled.

set_items(items, window, cx) matches both the committed and highlighted options by their unique values when the list changes. An open list keeps keyboard focus. If its highlighted option is removed or disabled, the cursor moves to the surviving selection or first enabled option. With no enabled options, the list closes. Updating the list emits no SelectEvent::Change.

InputResult
Enter / SpaceOpen the popup, or commit its highlighted option
Up / DownOpen and move among enabled options
Home / End while openHighlight the first / last enabled option without committing
Printable charactersCommit a matching option while closed; highlight it while open
EscapeDiscard the pending choice, close and restore trigger focus

Typeahead matches case-insensitive label prefixes and resets after one second. Repeated letters cycle matching options. Modified shortcuts, native character-preferred events and keys from descendant editors do not search. Opening/closing clears the prefix. This is a non-editable select; use Combobox for a visible native text query, grouped results or multiple selection.