Skip to main content

Select

Function Select 

Source
pub fn Select(
    id: Option<&'static str>,
    label: Option<&'static str>,
    options: Vec<SelectOption>,
    value: Option<Signal<String>>,
    on_change: Option<Rc<dyn Fn(&str)>>,
    disabled: Option<bool>,
    class: Option<&'static str>,
) -> View
Expand description

Accessible dropdown select with built-in open/close, highlight and value state.

State lives in persistent signals keyed by id (or by label and options when no id is given), so it survives root re-invocation without the caller owning any signal. Pass value to control the selection from outside, and on_change to observe it. Give each Select that shares the same options and label its own id.

Keyboard: Arrow keys move the highlight (and open the list), Home/End jump, Enter or Space picks, Escape closes. The list renders in the top layer anchored to the trigger, so it escapes overflow containers and flips when it would leave the viewport.