Expand description
Toggle — an animated on/off switch bound to a Signal<bool>.
Renders as a sliding-knob switch (IntUI default) or one of the alternate
ToggleVariant shapes. All visual chrome is delegated to a [ToggleStyle]
impl; the widget itself owns only event handling (tap, Space, AccessKit
Click). The IntUI recipe
(crate::styles::RecipeToggleStyle) ships out of the box; apps install a
custom look per-call with .style(impl ToggleStyle) or theme-wide via
theme.style_slots.toggle = Some(Rc::new(…)).
§Accessibility
Emits Role::Switch with toggled reflecting the signal value. Always pair
with .label(…) — the debug build asserts that a label is present, and
screen readers will announce “switch” with no context if it is absent.
§Example
let dark_mode = Signal::new(false);
let _w = Toggle::new(dark_mode)
.label(lit!("Dark mode"));Structs§
- Toggle
- An animated toggle switch bound to a
Signal<bool>.
Enums§
- Toggle
Variant - Toggle visual archetype. Most styles compose Switch; the others give designers explicit alternates without forking the widget.