Skip to main content

Module select

Module select 

Source
Expand description

Select / Combobox — a dropdown that picks one option from a list.

The selected index lives on the caller (&mut Option<usize>), mirroring the state-on-the-caller pattern used by Checkbox and List. Build it with an id salt (so multiple selects on a page don’t collide), a slice of option labels, and the bound selection:

sc::Select::new("fruit", &mut self.fruit)
    .options(["Apple", "Banana", "Cherry"])
    .placeholder("Pick a fruit")
    .show(ui);

Add searchable (or use Select::combobox) to get a filter field at the top of the dropdown.

Structs§

Select