glaze_oat/switch
Oat documentation: https://oat.ink/components/switch/
Switch helpers for binary on/off controls.
Anatomy
A switch UI is usually a checkbox input rendered with role="switch" and a
nearby label.
Recipe
import glaze_oat/switch
import lustre/attribute
import lustre/element/html
switch.label([], [
switch.switch([attribute.checked(True)]),
html.text("Enable notifications"),
])
References
- MDN ARIA
switchrole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/switch_role
Values
pub fn label(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn switch(
attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)