import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-dialog-header") export class HaDialogHeader extends LitElement { @property({ type: String, attribute: "subtitle-position" }) public subtitlePosition: "above" | "below" = "below"; @property({ type: Boolean, reflect: true, attribute: "show-border" }) public showBorder = false; protected render() { const titleSlot = html`
`; const subtitleSlot = html`
`; return html`
${this.subtitlePosition === "above" ? html`${subtitleSlot}${titleSlot}` : html`${titleSlot}${subtitleSlot}`}
`; } static get styles() { return [ css` :host { display: block; } :host([show-border]) { border-bottom: 1px solid var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12)); } .header-bar { display: flex; flex-direction: row; align-items: center; padding: 0 var(--ha-space-1); box-sizing: border-box; } .header-content { flex: 1; padding: 10px var(--ha-space-1); display: flex; flex-direction: column; justify-content: center; min-height: var(--ha-space-12); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .header-title { height: var( --ha-dialog-header-title-height, calc(var(--ha-font-size-xl) + var(--ha-space-1)) ); font-size: var(--ha-font-size-xl); line-height: var(--ha-line-height-condensed); font-weight: var(--ha-font-weight-medium); } .header-subtitle { font-size: var(--ha-font-size-m); line-height: var(--ha-line-height-normal); color: var(--secondary-text-color); } @media all and (min-width: 450px) and (min-height: 500px) { .header-bar { padding: 0 var(--ha-space-2); } } .header-navigation-icon { flex: none; min-width: var(--ha-space-2); height: 100%; display: flex; flex-direction: row; } .header-action-items { flex: none; min-width: var(--ha-space-2); height: 100%; display: flex; flex-direction: row; } `, ]; } } declare global { interface HTMLElementTagNameMap { "ha-dialog-header": HaDialogHeader; } }