Dialog <ha-wa-dialog>
+
+ Dialog component built with WebAwesome.
+ +Demos
+ + + +Design
+ +Width
+ +There are multiple widths available for the dialog.
+ +| Name | +Value | +
|---|---|
small |
+ min(320px, var(--full-width)) |
+
medium |
+ min(580px, var(--full-width)) |
+
large |
+ min(720px, var(--full-width)) |
+
full |
+ var(--full-width) |
+
+ --full-width is calculated based on the available width
+ of the screen. 95vw is the maximum width of the dialog on a large
+ screen, while on a small screen it is 100vw minus the safe area
+ insets.
+
Dialogs have a default width of medium.
Prevent scrim close
+ ++ You can prevent the dialog from being closed by clicking the + scrim/overlay. This is allowed by default. +
+ +Header
+ +The header contains a title, a subtitle and action items.
+ +| Slot | +Description | +
|---|---|
header |
+ The entire header area. | +
headerTitle |
+ The header title text. | +
headerSubtitle |
+ The header subtitle text. | +
headerActionItems |
+ The header action items. | +
Header title
+ +The header title is a text string.
+ +Header subtitle
+ +The header subtitle is a text string.
+ +Header action items
+ ++ The header action items usually containing icon buttons and/or menu + buttons. +
+ +Body
+ +The body is the content of the dialog.
+ +Footer
+ +The footer is the footer of the dialog.
+ +
+ It is recommended to use the ha-dialog-footer component
+ for the footer and to style the buttons inside the footer as so:
+
| Slot | +Description | +Variant to use | +
|---|---|---|
secondaryAction |
+ The secondary action button(s). | +plain |
+
primaryAction |
+ The primary action button(s). | +accent |
+
Implementation
+ +Example Usage
+ +<ha-wa-dialog
+ open
+ header-title="Dialog title"
+ header-subtitle="Dialog subtitle"
+ prevent-scrim-close
+>
+ <div slot="headerActionItems">
+ <ha-icon-button label="Settings" path="mdiCog"></ha-icon-button>
+ <ha-icon-button label="Help" path="mdiHelp"></ha-icon-button>
+ </div>
+ <div>Dialog content</div>
+ <ha-dialog-footer slot="footer">
+ <ha-button data-dialog="close" slot="secondaryAction" variant="plain"
+ >Cancel</ha-button
+ >
+ <ha-button slot="primaryAction" variant="accent">Submit</ha-button>
+ </ha-dialog-footer>
+</ha-wa-dialog>
+
+ API
+ ++ This component is based on the webawesome dialog component. Check the + webawesome documentation + for more details. +
+ +Attributes
+ +| Attribute | +Description | +Default | +Options | +
|---|---|---|---|
open |
+ Controls the dialog open state. | +false |
+ false, true |
+
width |
+ Preferred dialog width preset. | +medium |
+
+ small, medium, large,
+ full
+ |
+
prevent-scrim-close |
+ + Prevents closing the dialog by clicking the scrim/overlay. + | +false |
+ true |
+
header-title |
+ Header title text when no custom title slot is provided. | ++ | + |
header-subtitle |
+ + Header subtitle text when no custom subtitle slot is provided. + | ++ | + |
header-subtitle-position |
+ Position of the subtitle relative to the title. | +below |
+ above, below |
+
flexcontent |
+ + Makes the dialog body a flex container for flexible layouts. + | +false |
+ false, true |
+
CSS Custom Properties
+ +| CSS Property | +Description | +
|---|---|
--dialog-content-padding |
+ Padding for dialog content sections. | +
--ha-dialog-show-duration |
+ Show animation duration. | +
--ha-dialog-hide-duration |
+ Hide animation duration. | +
--ha-dialog-surface-background |
+ Dialog background color. | +
--ha-dialog-border-radius |
+ Border radius of the dialog surface. | +
--dialog-z-index |
+ Z-index for the dialog. | +
--dialog-surface-position |
+ CSS position of the dialog surface. | +
--dialog-surface-margin-top |
+ Top margin for the dialog surface. | +
Events
+ +| Event | +Description | +
|---|---|
opened |
+ Fired when the dialog is shown. | +
closed |
+ Fired after the dialog is hidden. | +