//// Oat documentation: //// //// 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 //// //// ```gleam //// 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 `switch` role: //// import lustre/attribute.{type Attribute} import lustre/element.{type Element} import lustre/element/html pub fn switch(attrs: List(Attribute(msg))) -> Element(msg) { html.input([attribute.type_("checkbox"), attribute.role("switch"), ..attrs]) } pub fn label( attrs: List(Attribute(msg)), children: List(Element(msg)), ) -> Element(msg) { html.label(attrs, children) }