Toggle
A pressable control that retains an on or off pressed state.
Loading interactive demo…
Toggle::new(pressed)
.root().on_click(toggle).child("Pin this item")#Import
Import Toggle from quickgui.
use quickgui::*;#Usage
Toggle::new(pressed)
.root().on_click(toggle).child("Pin this item")#Anatomy
Toggle::rootToggle::indicator
#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Toggle
View sourcepub const fn new(pressed: bool) -> Selfis_pressedpub const fn is_pressed(self) -> bool—
Toggle::root_with
View sourcepub fn root_with(self, root: Element) -> ElementDecorate an application-owned root without adding layout or appearance.
Toggle::root
View sourcepub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Toggle::indicator_with
View sourcepub fn indicator_with(self, indicator: Element) -> ElementHide an application-owned decorative indicator from the accessible name.
Toggle::indicator
View sourcepub fn indicator(self) -> ElementCreate the unstyled indicator part. Use [`Self::indicator_with`] to supply an existing element.
toggle
View sourcepub fn toggle(pressed: bool) -> ElementCreate an unstyled controlled toggle-button root. This shorthand is equivalent to `Toggle::new(pressed).root_with(div())`.
