Select

A dropdown selection component with keyboard navigation and search support.

Primitive: SelectARIA: role="combobox" + role="listbox"Keyboard: Arrow, Enter, Escape, Space
select.rs
use stratum_leptos::*;

view! {
    <Select placeholder="Select a framework...">
        <SelectOption value="leptos">"Leptos"</SelectOption>
        <SelectOption value="dioxus">"Dioxus"</SelectOption>
        <SelectOption value="sycamore">"Sycamore"</SelectOption>
    </Select>
}

Installation

stratum add select

Props

PropTypeDefaultDescription
valueOption<String>NoneControlled selected value
default_valueOption<String>NoneInitial value for uncontrolled usage
placeholderOption<String>NonePlaceholder when nothing is selected
disabledboolfalsePrevents interaction
on_changeOption<Callback<String>>NoneFires when selection changes

Accessibility

  • Trigger: role="combobox" with aria-expanded and aria-haspopup="listbox".
  • Dropdown: role="listbox" with options as role="option".
  • Arrow keys navigate, Enter selects, Escape closes, Space opens.

Source

Primitive: select.rs
Styled: select.rs