Skip to content

Commit 61b0252

Browse files
authored
Merge pull request #761 from MelleD/add-readme-examples
docs: consolidate some example from the github issues
2 parents 68c2638 + 3a5ee9e commit 61b0252

File tree

4 files changed

+74
-4
lines changed

4 files changed

+74
-4
lines changed

README.md

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,39 @@ Example title card that is clickable and has 2 nested cards, which is directly e
120120
name: null
121121
show_wind: speed
122122
```
123+
### Heading Title card
123124
124-
### Title
125+
Example with [heading](https://www.home-assistant.io/dashboards/heading/) title card to the possiblity to style your title.
126+
127+
```yaml
128+
- type: custom:expander-card
129+
title-card:
130+
type: heading
131+
heading: Title
132+
heading_style: title
133+
badges:
134+
- type: entity
135+
show_name: false
136+
show_state: true
137+
show_icon: true
138+
entity: light.bed_light
139+
icon: mdi:account
140+
```
141+
142+
### Template Title card with Mushroom
143+
144+
If you need templates in your title, you can make good use of the Mushroom cards. Here's an example using the [Mushroom title card](//github.com/piitaya/lovelace-mushroom/blob/main/docs/cards/title.md).
145+
https:
146+
147+
```yaml
148+
- type: custom:expander-card
149+
title-card:
150+
type: custom:mushroom-title-card
151+
title: |-
152+
{{ now().hour }}
153+
```
154+
155+
### Simple Title
125156
126157
Example with title that is clickable and has 2 nested cards.
127158
@@ -186,6 +217,32 @@ Example with title that is clickable and has 2 nested cards with are automatical
186217
show_wind: speed
187218
```
188219
220+
### Title card with action
221+
222+
The configuration below will open or close the expander when you tap the Mushroom Light Card. This means you cannot switch the light on or off by tapping it, but you can still adjust the brightness.
223+
224+
```yaml
225+
type: custom:expander-card
226+
title: Expander Card
227+
expander-card-id: my-light-card
228+
cards:
229+
- type: entities
230+
entities:
231+
- entity: sun.sun
232+
title-card:
233+
type: tile
234+
entity: light.bed_light
235+
vertical: false
236+
features_position: inline
237+
features:
238+
- type: light-brightness
239+
tap_action:
240+
action: fire-dom-event
241+
expander-card:
242+
data:
243+
expander-card-id: my-light-card
244+
action: toggle
245+
```
189246
## Set state via action
190247
191248
You can set the state of expander card(s) using the `fire-dom-event` action on any card that supports actions.
@@ -231,11 +288,11 @@ tap_action:
231288

232289
You can do advanced styling using the `style` configuration parameter. Classes available are per the images below.
233290

234-
![Expander Card Styling - Title](https://github.com/user-attachments/assets/e582975e-5f47-497a-8344-4378ad32f2d6)
291+
![Expander Card Styling - Title](examples/styling1.png)
235292

236-
![Expander Card Styling - Card](https://github.com/user-attachments/assets/815d4af8-46a6-4ea8-a85f-b40ca594597b)
293+
![Expander Card Styling - Card](examples/styling2.png)
237294

238-
![Expander Card Styling - Card & Overlay](https://github.com/user-attachments/assets/08a6234b-45f6-49c9-bd9a-b356dd748c4a)
295+
![Expander Card Styling - Card & Overlay](examples/styling3.png)
239296

240297
### State
241298

@@ -316,6 +373,19 @@ style: |
316373
}
317374
```
318375

376+
Change the title size
377+
```yaml
378+
style: |
379+
.title {
380+
font-size: var(--ha-font-size-l);
381+
}
382+
```
383+
384+
## Card Mod
385+
386+
Before the `style` attribute, [card mod](https://github.com/thomasloven/lovelace-card-mod) was used to style the card. Although card-mod still works, it is better to switch everything to use the `style` attribute. Please do not open issue(s) when card mod is not working.
387+
388+
319389
## Installation
320390

321391
### HACS

examples/styling1.png

59.5 KB
Loading

examples/styling2.png

47.8 KB
Loading

examples/styling3.png

65.2 KB
Loading

0 commit comments

Comments
 (0)