@@ -15,7 +15,7 @@ Subscribe to Youtube channel: https://www.youtube.com/@My_Smart_Home
1515- Organize any cards into a clean tabbed layout
1616- Top or bottom tab positioning
1717- Start/center/end tab alignment
18- - Per-tab icon, title, badge template , and deep-link ` id `
18+ - Per-tab icon, title, badge rules, badge display mode , and deep-link ` id `
1919- Dynamic tab visibility with ` entity ` , ` template ` , and ` user ` conditions
2020- Dynamic default tab rules
2121- Swipe navigation with automatic nested horizontal-scroll detection
@@ -133,13 +133,51 @@ Each entry in the `tabs` list is an object with the following properties:
133133| `card` | object | Conditionally required | A standard Lovelace card configuration (single-card mode). |
134134| `cards` | list | Conditionally required | List of Lovelace card configurations (multi-card mode). |
135135| `conditions` | list | Optional | A list of conditions (`entity`, `template`, or `user`) that must be met to show the tab. |
136- | `badge` | string | Optional* | Jinja template that outputs true/false |
136+ | `badge` | string | Optional* | Legacy single Jinja template that outputs true/false |
137+ | `badge_templates` | list | Optional | List of Jinja templates. If any evaluate truthy, the badge is shown. |
138+ | `badge_display` | string | Optional | Badge display mode : ` dot` , `count`, or `exclamation`. |
137139| `id`| string | Optional | ID of tab, for deeplinking | none |
138140
139141
140142*Either `title` or `icon` should be defined.
141143*Use either `card` or `cards`.
142144
145+ # ## Badge Configuration
146+
147+ Badges can be configured in two ways :
148+
149+ - `badge` : a legacy single Jinja template that shows the badge when the result is truthy.
150+ - `badge_templates` : a list of Jinja templates. If any of them evaluate truthy, the badge is shown.
151+ - `badge_display` : controls the badge style. Use `dot`, `count`, or `exclamation`.
152+
153+ A result is treated as truthy when it returns values such as `true`, `on`, or a number greater than `0`.
154+
155+ Example with a single badge rule :
156+
157+ ` ` ` yaml
158+ tabs:
159+ - title: Kitchen
160+ badge: "{{ is_state('light.kitchen', 'on') }}"
161+ card:
162+ type: markdown
163+ content: Kitchen
164+ ` ` `
165+
166+ Example with multiple badge rules and a counted badge :
167+
168+ ` ` ` yaml
169+ tabs:
170+ - title: Alerts
171+ badge_display: count
172+ badge_templates:
173+ - "{{ is_state('binary_sensor.front_door', 'on') }}"
174+ - "{{ is_state('binary_sensor.back_door', 'on') }}"
175+ - "{{ states('sensor.unread_notifications') | int > 0 }}"
176+ card:
177+ type: markdown
178+ content: Alerts overview
179+ ` ` `
180+
143181# # Advanced Configuration
144182
145183# ## Dynamic Default Tab
@@ -243,3 +281,7 @@ tabs:
243281
244282See releases :
245283https://github.com/agoberg85/home-assistant-simple-tabs/releases
284+
285+ # # Use Of AI
286+
287+ I am a frontend developer and have used AI tools to help build some of the functionality of this custom dashboard card. All features have been heavily tested on the various devices I have available.
0 commit comments