howdy/ui/toggle
Toggles: buttons that stay pressed, alone or in a group.
toggle.toggle(False, [attribute.aria_label("Bold")], [text("B")])
toggle.group(toggle.Single, [attribute.aria_label("Alignment")], [
toggle.toggle(True, [attribute.aria_label("Left")], [text("⇤")]),
toggle.toggle(False, [attribute.aria_label("Centre")], [text("↔")]),
])
Clicking a toggle flips its aria-pressed in the browser. In a Single
group, pressing one releases the others; in a Multiple group each is
independent. A live view that keeps the state should update its model
from each toggle’s click, so the server’s idea never falls behind.
Types
Values
pub fn group(
selection: Selection,
attributes: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
Toggles joined into one control. Label it with aria-label; pass
attribute.aria_orientation("vertical") to stack them, which also makes
up and down the keys that move between them. The group is one stop in
the tab order, and the arrow keys move within it.
pub fn group_class() -> css.Class
pub fn toggle(
pressed: Bool,
attributes: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn toggle_class() -> css.Class