diff --git a/gallery/src/demos/demo-ha-chip.ts b/gallery/src/demos/demo-ha-chip.ts new file mode 100644 index 0000000000..8344d4eb64 --- /dev/null +++ b/gallery/src/demos/demo-ha-chip.ts @@ -0,0 +1,61 @@ +import { mdiHomeAssistant } from "@mdi/js"; +import { css, html, LitElement, TemplateResult } from "lit"; +import { customElement } from "lit/decorators"; +import "../../../src/components/ha-card"; +import "../../../src/components/ha-chip"; +import "../../../src/components/ha-svg-icon"; + +const chips: { + icon?: string; + content?: string; +}[] = [ + {}, + { + icon: mdiHomeAssistant, + }, + { + content: "Content", + }, + { + icon: mdiHomeAssistant, + content: "Content", + }, +]; + +@customElement("demo-ha-chip") +export class DemoHaChip extends LitElement { + protected render(): TemplateResult { + return html` + +
+ ${chips.map( + (chip) => html` + + ${chip.icon + ? html` + ` + : ""} + ${chip.content} + + ` + )} +
+
+ `; + } + + static get styles() { + return css` + ha-card { + max-width: 600px; + margin: 24px auto; + } + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "demo-ha-chip": DemoHaChip; + } +}