Components / Select
Select
Picks one option from a list in a field-like trigger.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn select() -> impl View {
let range = State::new(0);
// `Select::of` holds the value itself; `.searchable()` adds a search box.
let currency = State::new("BRL");
VStack::new((
Select::new(range.binding(), ["Last 7 days", "Last 30 days", "This year"]).label("Date range"),
Select::of(currency.binding(), [("BRL", "Real"), ("EUR", "Euro"), ("USD", "Dollar")])
.label("Currency")
.size(ButtonSize::Small)
.searchable(),
))
.spacing(8.0)
}