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.
| Input | Result |
|---|---|
| Enter / Space | Open the popup, or commit its highlighted option |
| Up / Down | Open and move among enabled options |
| Home / End while open | Highlight the first / last enabled option without committing |
| Printable characters | Commit a matching option while closed; highlight it while open |
| Escape | Discard 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.