glaze/basecoat/dialog

Basecoat documentation: https://basecoatui.com/components/dialog/

The dialog helpers build native HTML dialog flows for confirmations, forms, and focused tasks.

Anatomy

A dialog flow usually includes a dialog container and a trigger that opens it.

attrs go on the <dialog> element, panel_attrs on the visible panel inside it. Sizing helpers like max_width belong in panel_attrs.

Recipe

import glaze/basecoat/button
import glaze/basecoat/dialog
import lustre/element/html

fn edit_profile_dialog() {
  dialog.dialog_with_description(
    "edit-profile",
    "Edit profile",
    "Make changes to your profile here.",
    [dialog.close_on_backdrop()],
    [dialog.max_width("425px")],
    [
      dialog.content([], [html.text("Dialog content here.")]),
      dialog.footer([], [
        button.button([], [html.text("Save")]),
      ]),
    ],
  )
}

References

Values

pub fn close_button(
  attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn close_on_backdrop() -> attribute.Attribute(msg)
pub fn close_script(dialog_id: String) -> String
pub fn content(
  attrs: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn dialog(
  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 dialog_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 full_width() -> attribute.Attribute(msg)
pub fn header(
  attrs: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn max_height(height: String) -> attribute.Attribute(msg)
pub fn max_width(width: String) -> attribute.Attribute(msg)
pub fn open_script(dialog_id: String) -> String
pub fn responsive_width(
  width: String,
) -> attribute.Attribute(msg)
pub fn scrollable_content(
  attrs: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn trigger_button(
  dialog_id: String,
  attrs: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)
✨ Search Document