1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-19 18:28:42 +00:00

Add icons to tabs

This commit is contained in:
Aidan Timson
2025-12-11 14:41:55 +00:00
parent 253b49871e
commit ffcb285654

View File

@@ -21,7 +21,7 @@ export class HaTab extends LitElement {
aria-label=${ifDefined(this.name)}
@keydown=${this._handleKeyDown}
>
${this.narrow ? html`<slot name="icon"></slot>` : ""}
<slot name="icon"></slot>
<span class="name">${this.name}</span>
<ha-ripple></ha-ripple>
</div>
@@ -50,6 +50,11 @@ export class HaTab extends LitElement {
outline: none;
}
:host(:not([narrow])) div {
flex-direction: row;
gap: var(--ha-space-2);
}
.name {
white-space: nowrap;
overflow: hidden;
@@ -76,6 +81,14 @@ export class HaTab extends LitElement {
padding: 0 4px;
}
::slotted([slot="icon"]) {
margin-bottom: var(--ha-space-1);
}
:host(:not([narrow])) ::slotted([slot="icon"]) {
margin-bottom: 0;
}
div:focus-visible:before {
position: absolute;
display: block;