Add close button when not confirmation/alert dialog

This commit is contained in:
Aidan Timson
2025-10-28 10:11:14 +00:00
parent aa21eff508
commit 1aa55b3071

View File

@@ -1,4 +1,4 @@
import { mdiAlertOutline } from "@mdi/js"; import { mdiAlertOutline, mdiClose } from "@mdi/js";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators"; import { customElement, property, query, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined"; import { ifDefined } from "lit/directives/if-defined";
@@ -70,6 +70,15 @@ class DialogBox extends LitElement {
aria-describedby="dialog-box-description" aria-describedby="dialog-box-description"
> >
<ha-dialog-header slot="header"> <ha-dialog-header slot="header">
${!confirmPrompt
? html`<slot name="headerNavigationIcon" slot="navigationIcon">
<ha-icon-button
data-dialog="close"
.label=${this.hass?.localize("ui.common.close") ?? "Close"}
.path=${mdiClose}
></ha-icon-button
></slot>`
: nothing}
<span slot="title" id="dialog-box-title"> <span slot="title" id="dialog-box-title">
${this._params.warning ${this._params.warning
? html`<ha-svg-icon ? html`<ha-svg-icon