glaze/basecoat/theme_switcher

Basecoat documentation: https://basecoatui.com/components/theme-switcher/

Theme switcher helpers for toggling a light/dark class.

Note: This component requires the theme script in the <head>.

Recipe

import glaze/basecoat/theme_switcher
import lustre/element/html

fn my_theme_switcher() {
  theme_switcher.button([])
}

Add the initialization script once in your document <head>:

html.head([], [
  theme_switcher.init_script(),
])

References

Values

pub fn button(
  attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn button_with_tooltip(
  tooltip_side: String,
  attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn init_script() -> element.Element(msg)
pub fn set_dark_script() -> String
pub fn set_light_script() -> String
pub fn toggle_script() -> String
Search Document