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 selectProps
| Prop | Type | Default | Description |
|---|---|---|---|
| value | Option<String> | None | Controlled selected value |
| default_value | Option<String> | None | Initial value for uncontrolled usage |
| placeholder | Option<String> | None | Placeholder when nothing is selected |
| disabled | bool | false | Prevents interaction |
| on_change | Option<Callback<String>> | None | Fires when selection changes |
Accessibility
- Trigger:
role="combobox"witharia-expandedandaria-haspopup="listbox". - Dropdown:
role="listbox"with options asrole="option". - Arrow keys navigate,
Enterselects,Escapecloses,Spaceopens.