| * Written by the Home Assistant frontend authors, and copied here under the |
| * (https://github.com/home-assistant/frontend/blob/dev/LICENSE.md). |
| * https://github.com/home-assistant/frontend/blob/4922e575f822c65d81fcde1225cfee5e338ac997/src/components/ha-svg-icon.ts |
| import {css, CSSResultGroup, LitElement, svg, SVGTemplateResult} from 'lit'; |
| import {customElement, property} from 'lit/decorators.js'; |
| @customElement('ha-svg-icon') |
| export class HaSvgIcon extends LitElement { |
| @property() public path?: string; |
| @property() public viewBox?: string; |
| protected render(): SVGTemplateResult { |
| viewBox=${this.viewBox || '0 0 24 24'} |
| preserveAspectRatio="xMidYMid meet" |
| ${this.path ? svg`<path d=${this.path}></path>` : ''} |
| static get styles(): CSSResultGroup { |
| display: var(--ha-icon-display, inline-flex); |
| width: var(--mdc-icon-size, 24px); |
| height: var(--mdc-icon-size, 24px); |
| interface HTMLElementTagNameMap { |
| 'ha-svg-icon': HaSvgIcon; |