glaze/basecoat/drawer
Basecoat documentation: https://basecoatui.com/components/drawer/
A panel that slides in from an edge of the screen. Requires Basecoat’s JavaScript.
attrs go on the <dialog> element, panel_attrs on the visible panel
inside it. Clicking the backdrop closes the drawer.
Recipe
import glaze/basecoat/button
import glaze/basecoat/drawer
import lustre/attribute
import lustre/element/html
fn goal_drawer() {
html.div([], [
button.outline(
[attribute.attribute("onclick", drawer.open_script("goal"))],
[html.text("Open")],
),
drawer.drawer("goal", "Move goal", [], [], [
drawer.content([], [html.text("Set your daily activity goal.")]),
drawer.footer([], [button.button([], [html.text("Submit")])]),
]),
])
}
Values
pub fn close_script(drawer_id: String) -> String
pub fn content(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn drawer(
id: String,
title: String,
attrs: List(attribute.Attribute(msg)),
panel_attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn drawer_with_description(
id: String,
title: String,
description: String,
attrs: List(attribute.Attribute(msg)),
panel_attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn footer(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn left() -> attribute.Attribute(msg)
pub fn open_script(drawer_id: String) -> String
pub fn right() -> attribute.Attribute(msg)