Skip to main content

basecoat_core/props/
dialog.rs

1use crate::{AttrMap, BasecoatProps, Children, Markup};
2use std::borrow::Cow;
3
4/// Dialog — maps to CSS class `.dialog`.
5///
6/// Upstream basecoat uses the native `<dialog>` element with a JS controller
7/// for open/close. The `id` is required for the controller to find the element.
8#[derive(BasecoatProps, Default, Clone, Debug)]
9pub struct DialogProps {
10    /// Unique DOM id — required for the WASM controller.
11    #[prop(optional, into)]
12    pub id: Option<Cow<'static, str>>,
13    /// Optional trigger button content.
14    #[prop(optional)]
15    pub trigger: Option<Markup>,
16    /// Dialog title displayed in the `<header>`.
17    #[prop(optional, into)]
18    pub title: Option<Cow<'static, str>>,
19    /// Dialog description displayed below the title.
20    #[prop(optional, into)]
21    pub description: Option<Cow<'static, str>>,
22    /// Footer HTML content.
23    #[prop(optional)]
24    pub footer: Option<Markup>,
25    /// Whether to render a close button (default true).
26    #[prop(default = true)]
27    pub close_button: bool,
28    /// Whether clicking the overlay closes the dialog (default true).
29    #[prop(default = true)]
30    pub close_on_overlay_click: bool,
31    #[prop(optional, into)]
32    pub class: Option<Cow<'static, str>>,
33    #[prop(extend)]
34    pub attrs: AttrMap,
35    pub children: Children,
36}