From 325fcbfcced373408b71c6cedc9debe30f43b24c Mon Sep 17 00:00:00 2001 From: ildar170975 <71872483+ildar170975@users.noreply.github.com> Date: Tue, 25 Feb 2025 11:31:29 +0300 Subject: [PATCH 1/5] added "persistentID" option --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9705d99..2da8e65 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ tabs: minWidth?: boolean isMinWidthIndicator?: boolean stacked?: boolean + persistentID?: string ``` ### Example @@ -131,6 +132,7 @@ See the full list of exposed custom properties: [``](https://github.com | `minWidth` | `false` | Shrinks tab as narrow as possible without causing text to wrap. | | `isMinWidthIndicator` | `false` | Shrinks indicator to be the size of the content. | | `stacked` | `false` | Stacks icon on top of label text. | +| `persistentID` | `""` | Persistent part of `id` for `mwc-tab` element (tab level only) | Global attributes: @@ -199,6 +201,12 @@ tabs: ![Local Attributes](assets/local-attributes.png) + +## Usage of `persistentID` + +Every `mwc-tab` element gets an `id` as a combination of some static part & dynamic part to ensure a unique value of `id`. +A value of an optional `persistentID` option is used to customize the static part which can be useful in card-mod customizations to refer a particular tab. + ## Appreciation Thanks for the support and services provided ![Home Assistant](https://avatars.githubusercontent.com/u/13844975?s=24) [Home Assistant](https://www.home-assistant.io/), ![HACS](https://avatars.githubusercontent.com/u/56713226?s=24) [HACS](https://hacs.xyz/) and ![lit](https://avatars.githubusercontent.com/u/18489846?s=24) [lit](https://lit.dev/) 🥰 Aslo, thanks to the [swipe-card](https://github.com/bramkragten/swipe-card) for inspiration and all of the other open source cards/projects as references. From 6d3be477ef04886bd4a82755142b485530316890 Mon Sep 17 00:00:00 2001 From: ildar170975 <71872483+ildar170975@users.noreply.github.com> Date: Tue, 25 Feb 2025 12:14:07 +0300 Subject: [PATCH 2/5] added "persistentID" --- src/tabbed-card.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tabbed-card.ts b/src/tabbed-card.ts index b7b3141..a8e395f 100644 --- a/src/tabbed-card.ts +++ b/src/tabbed-card.ts @@ -39,6 +39,7 @@ interface Tab { minWidth?: boolean; isMinWidthIndicator?: boolean; stacked?: boolean; + persistentID?: string; }; card: LovelaceCardConfig; } @@ -164,6 +165,11 @@ export class TabbedCard extends LitElement { (tab) => html` Date: Tue, 25 Feb 2025 13:03:20 +0300 Subject: [PATCH 3/5] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8dd477f..c8463f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tabbed-card", - "version": "0.1.0", + "version": "0.4.0", "description": "a custom card for home assistant that utilizes tabs to segregate individual cards.", "keywords": [ "home-assistant", From 9575df5d24fb7468f07a0db666c84c57a4a8296f Mon Sep 17 00:00:00 2001 From: ildar170975 <71872483+ildar170975@users.noreply.github.com> Date: Tue, 25 Feb 2025 14:20:59 +0300 Subject: [PATCH 4/5] prettier --- src/tabbed-card.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tabbed-card.ts b/src/tabbed-card.ts index a8e395f..ef6e740 100644 --- a/src/tabbed-card.ts +++ b/src/tabbed-card.ts @@ -165,11 +165,12 @@ export class TabbedCard extends LitElement { (tab) => html` Date: Tue, 25 Feb 2025 14:23:29 +0300 Subject: [PATCH 5/5] revert --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8463f5..8dd477f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tabbed-card", - "version": "0.4.0", + "version": "0.1.0", "description": "a custom card for home assistant that utilizes tabs to segregate individual cards.", "keywords": [ "home-assistant",