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

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)
Search Document