-
-
Notifications
You must be signed in to change notification settings - Fork 0
Using Templates
Once a template exists (Defining Templates), you instantiate it with
custom:decluttering-card-plus.
type: custom:decluttering-card-plus
template: room_light
variables:
- light: light.living_room
- room: Living RoomThat is the whole syntax. template: names the template, variables: fills in its holes.
| Option | Type | Required | Description |
|---|---|---|---|
type |
string | ✅ | custom:decluttering-card-plus |
template |
string | ✅ | Name of the template to use |
variables |
list | — | Values to substitute. See Variables. |
style |
string | — | CSS to inject. See Styling. |
variablesis a list of single-key mappings, each starting with-:variables: - light: light.kitchen # ✅ - room: Kitchennot
variables: light: light.kitchen # ❌ rejected room: Kitchen
The same custom:decluttering-card-plus type is used everywhere. What matters is that the
template's content type suits the place you put it.

Three places, one card type: the badges, the two tiles and the three rows are each
custom:decluttering-card-plus pointing at a badge, card and row template.
Anywhere a card goes — a view, a stack, a grid, a section:
views:
- title: Home
cards:
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: light.living_room
- room: Living RoomIn a view's badges: list (sections views):
views:
- type: sections
badges:
- type: custom:decluttering-card-plus
template: power_badge
variables:
- entity: sensor.solar_power
- name: SolarIn an Entities card's entities: list:
- type: entities
title: Temperatures
entities:
- type: custom:decluttering-card-plus
template: temperature_row
variables:
- entity: sensor.living_room_temperature
- name: Living RoomIn a Picture Elements card's elements: list, where style carries the positioning:
- type: picture-elements
image: /local/floorplan.png
elements:
- type: custom:decluttering-card-plus
template: room_marker
variables:
- light: light.living_room
style:
top: 32%
left: 26%See Cards, Badges, Rows and Elements for the detail of each.
A template's content can itself contain custom:decluttering-card-plus cards, so templates
can build on each other:
decluttering_templates:
room_light:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
room_pair:
card:
type: horizontal-stack
cards:
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: '[[light_a]]'
- room: '[[room_a]]'
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: '[[light_b]]'
- room: '[[room_b]]'Variables pass straight through — '[[light_a]]' is substituted in room_pair, and the
result is handed to room_light as its light.
Nothing stops you putting a row template into a view as a card, or a card template into
an Entities card. It will usually render, but it will not look right — rows expect the
layout an Entities card gives them, cards expect to be cards. Match the content type to the
place.
Instantiating a template is not just a copy-and-paste. The card wraps your content in Home Assistant's own machinery, so templated content behaves like content written inline:
-
visibilityconditions work inside the template, and the wrapper collapses when the card hides — see Visibility. - Grid options are forwarded, so a card that asks for a particular width in a sections view still gets it — see Cards.
- A card that hides itself leaves no gap in the layout.
- Rebuilds are handled, so cards that ask to be recreated are.
→ Variables — defaults, types, and the rules of substitution
Getting started
Core concepts
Content types
Features
- Repeating a Template
- Sharing Between Dashboards
- Sharing a Template
- Visibility
- Styling
- Visual Editors
- Translations
Reference