You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`tabs`| list |**Required**| A list of tab objects to display. See below. ||
44
51
|`alignment`| string | Optional | Justification for the row of tabs. (`start`, `center`, `end`) |`'center'`|
45
-
|`default_tab`| number | Optional | Defines the default tab. If a tab is hidden via conditions it will fall back to the first visible tab. |`1`|
52
+
|`default_tab`| number/list | Optional | Defines the default tab. Can be a static number (1-based) or a list of conditional rules (see Advanced Configuration). |`1`|
53
+
|`hide_inactive_tab_titles`| boolean | Optional | If `true`, hides the title text on tabs that are not currently active (showing only the icon). |`false`|
46
54
|`pre-load`| boolean | Optional | If `true`, renders all tab content on load for faster switching. |`false`|
47
55
|`background-color`| string | Optional | CSS color for the button background. |`none`|
48
56
|`border-color`| string | Optional | CSS color for the button border. | Your theme's `divider-color`|
@@ -63,42 +71,84 @@ Each entry in the `tabs` list is an object with the following properties:
63
71
|`title`| string | Optional*| The text to display on the tab. Can be jinja template |
64
72
|`icon`| string | Optional*| An MDI icon to display next to the title (e.g., `mdi:lightbulb`). Can be jinja template |
65
73
|`card`| object |**Required**| A standard Lovelace card configuration. |
66
-
|`conditions`| list | Optional | A list of conditions that must be met to show the tab. See [EXAMPLES.md](EXAMPLES.md)|
74
+
|`conditions`| list | Optional | A list of conditions (`entity`, `template`, or `user`) that must be met to show the tab. |
67
75
68
76
*Either title or icon has to be defined.
69
77
78
+
## Advanced Configuration
79
+
80
+
### Dynamic Default Tab
81
+
82
+
Instead of a static number, `default_tab` can be a list of rules. The card will check them from top to bottom and select the first one that matches.
83
+
84
+
**Note:** It is recommended to use `entity` state checks here rather than `template` for faster initial loading.
85
+
86
+
```yaml
87
+
default_tab:
88
+
# 1. If TV is on, open Tab 2 (Controls)
89
+
- tab: 2
90
+
conditions:
91
+
- entity: media_player.tv
92
+
state: 'on'
93
+
# 2. If it is night time, open Tab 3 (Bedroom)
94
+
- tab: 3
95
+
conditions:
96
+
- entity: sun.sun
97
+
state: 'below_horizon'
98
+
# 3. Fallback to Tab 1
99
+
- tab: 1
100
+
```
101
+
102
+
### User Visibility (Privacy)
103
+
104
+
You can hide specific tabs from specific users by adding a `user` condition. You will need the long User ID string (found in HA Settings -> People -> Users -> Click User -> ID at bottom).
105
+
106
+
```yaml
107
+
tabs:
108
+
- title: Admin Controls
109
+
icon: mdi:shield-account
110
+
conditions:
111
+
- user:
112
+
- "8234982374982374982374" # Dad
113
+
- "1928371928371928371928" # Mom
114
+
card:
115
+
# ...
116
+
```
117
+
70
118
## Example Usage
71
119
72
-
### Example Configuration
120
+
### Full Example
73
121
74
-
This will create two centered tabs.
122
+
This configuration demonstrates dynamic defaults, user restrictions, and the compact "hide inactive titles" style.
0 commit comments