Skip to main content

picker

Function picker 

Source
pub fn picker<T, Sel, M>(
    selected: Sel,
    options: impl IntoPickerOptions<T, M>,
) -> Picker<T, Required<Sel>>
where T: Clone + PartialEq + 'static, Sel: Binding<T>,
Expand description

picker(sort, [(Sort::Name, res::str::name()), (Sort::Date, res::str::date())]).segmented(): selected is a two-way binding to the chosen value (a Signal<T>, a day-model Field, a Mapped view), and the options are (value, title) pairs, fixed or derived from a closure. The mapping between values and the native control’s indexes lives here, once.

Selection rules (docs/picker.md): the picker never writes the binding on its own, only a user’s choice does. A bound value that is not among the options shows no selection where the toolkit can show none, and the first option otherwise; empty options disable the control; when the options change, the native index is re-derived from the value, and a native choice that arrives after the options changed is mapped against the options the control was last given.

Day API ↩ Guides· daybrite.dev