glaze/basecoat/switch
Basecoat documentation: https://basecoatui.com/components/switch/
Switch helpers for binary on/off controls.
Recipe
import glaze/basecoat/switch
import lustre/attribute
fn airplane_mode() {
switch.switch([
attribute.id("airplane-mode"),
])
}
References
- MDN ARIA
switchrole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/switch_role
Values
pub fn checked() -> attribute.Attribute(msg)
pub fn disabled() -> attribute.Attribute(msg)
pub fn id(id: String) -> attribute.Attribute(msg)
pub fn name(n: String) -> attribute.Attribute(msg)
pub fn switch(
attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn with_description(
id: String,
label_text: String,
description: String,
attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn with_label(
id: String,
label_text: String,
attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)