Skip to main content

euv_ui/component/toggle/view/
struct.rs

1use super::*;
2
3/// Props for the `euv_toggle` component.
4///
5/// The pressed state lives in a caller-owned `Signal<bool>` so the control
6/// takes part in two-way binding with the rest of the page.
7#[derive(Clone, CustomDebug, Data, Default, New)]
8pub struct EuvToggleProps {
9    /// The signal holding the pressed state.
10    #[get(type(copy))]
11    pub pressed: Signal<bool>,
12    /// The visual variant.
13    #[get(type(copy))]
14    pub variant: EuvToggleVariant,
15    /// The control size.
16    #[get(type(copy))]
17    pub size: EuvToggleSize,
18    /// The label shown inside the control.
19    #[get(type(copy))]
20    pub label: &'static str,
21    /// Whether the control is disabled.
22    #[get(type(copy))]
23    pub disabled: Signal<bool>,
24    /// Optional callback receiving the new pressed state.
25    #[debug(skip)]
26    pub on_change: Option<Rc<dyn Fn(bool)>>,
27}