Cards
The most common content type. A card template holds any dashboard card — built in,
custom, or a stack containing others — and can be used anywhere a card goes.
decluttering_templates:
room_light:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
features:
- type: toggle
type: custom:decluttering-card-plus
template: room_light
variables:
- light: light.living_room
- room: Living Room
Where cards can go
Anywhere Home Assistant accepts a card:
- a view’s
cards:list - a section’s
cards:list in a sections view - inside
vertical-stack,horizontal-stack,grid,conditional - inside another template
Templating a whole stack
Cards are at their most useful when the thing you are repeating is complicated. This template is a heading plus a two-column grid — five nested levels, written once:
decluttering_templates:
room_summary:
card:
type: vertical-stack
cards:
- type: heading
heading: '[[room]]'
icon: '[[icon]]'
- type: grid
columns: 2
square: false
cards:
- type: tile
entity: '[[light]]'
name: Light
features:
- type: toggle
- type: tile
entity: '[[temperature]]'
name: Temperature
default:
- icon: mdi:home-outline
Four rooms, four uses:
- type: custom:decluttering-card-plus
template: room_summary
variables:
- room: Living Room
- icon: mdi:sofa
- light: light.living_room
- temperature: sensor.living_room_temperature
- type: custom:decluttering-card-plus
template: room_summary
variables:
- room: Kitchen
- icon: mdi:silverware-fork-knife
- light: light.kitchen
- temperature: sensor.kitchen_temperature
# …and so on

A set of cards as one card: group: (v1.14.0+)
Cards in a stack are sized by the stack, so a template holding a heading and three tiles in
a vertical-stack shows the tiles one under another, not two to a row as the section would.
group: in place of card: holds the cards without a stack. Each one gets the place in the
section it would have had written out on its own, grid_options and all:
decluttering_templates:
room:
default:
- room: kitchen
group:
cards:
- type: heading
heading: '[[room]]'
- type: custom:decluttering-card-plus
template: light_tile
variables:
- entity: 'light.[[room]]'
- type: tile
entity: 'sensor.[[room]]_temperature'
- type: tile
entity: 'sensor.[[room]]_humidity'
- type: custom:decluttering-card-plus
template: room
variables:
- room: bedroom

The group fills the width of its section, unless it says otherwise,
and lays its cards out on the section’s own grid, so a wider section gives them more room
the same way it would anyway. Variables reach the
cards in a group like any other content, and the group’s default: covers the defaults for
the whole set. for_each repeats the whole group, one copy under another.
cards: can be left out and the list written straight under group:. This does the same
as the template above:
decluttering_templates:
room:
group:
- type: heading
heading: '[[room]]'
- type: tile
entity: 'sensor.[[room]]_temperature'
Write it with cards: when you also want grid_options
on the group, since a bare list has nowhere to put them. A group: that is neither a list
nor has a cards: list gives the error group: needs a list of cards, written under
cards:.
On the dashboard the group is still one card: it is dragged, edited and deleted as a whole. Outside a sections view its cards go one under another, which is where they would be in a masonry column anyway.
When every card in a group is hidden by its visibility, the group hides too (v1.15.0+),
so a section with nothing else in it disappears the way it would with the cards written out.
A group with no cards at all is left in place.
Hidden cards, in edit mode (v2.1.0+)

Edit mode shows every card, hidden or not, which is what lets you edit one whose conditions
are not met just now. In a group that made it hard to see what the dashboard really shows, so
a card its visibility hides outside edit mode is dimmed, and the group says under its cards
how many that is: here the Front door open tile only appears when the door is open. Outside
edit mode nothing changes.
A whole section can become a group template from the template editor (v2.1.0+), and a group’s cards can be dragged into order there; see Visual Editors.
The same template in a view’s badges is a set of badges (v1.15.0+) — see Badges.
Sizing the group itself (v1.15.2+)
grid_options on the group: sizes the group in its section, the same way it sizes any
card. It can take variables, so a repeated group can give each copy its own width. The card
below repeats the template with for_each_from:, one copy per light Home Assistant knows
about, and overrides: gives a named copy values of its own; both are explained on
Repeating a Template and listed on the
Repeat Reference:
decluttering_templates:
room_tile:
default:
- width: 6
group:
grid_options:
columns: '[[width]]'
cards:
- type: tile
entity: '[[entity]]'
grid_options:
columns: full
- type: custom:decluttering-card-plus
template: room_tile
for_each_from:
domain: light
overrides:
light.bedroom:
width: 12

Each copy takes half the section, two to a row, and the one overridden to 12 takes the whole
row. The grid_options of the cards inside the group still size them within the group.
- A group used once is sized the same way:
grid_options: { columns: 6 }makes it half the section rather than all of it. - A
grid_optionswritten at the top of the template, or on the card using it, sizes the whole card and is the same for every copy. Placeholders there are not filled, so a size that comes from a variable goes insidegroup:. - Copies laid out with
columns:go in a grid card of their own, which leaves the group’sgrid_optionsunread.
One card, a different template per domain (v2.0.0+)
A repeated card over a mix of entities can give each kind its own template, the lights a
toggle tile and the sensors a graph, with template_by_domain: in place of template::
type: custom:decluttering-card-plus
template_by_domain:
light: light_tile
sensor: sensor_graph
default: plain_tile
for_each_from:
area: Living Room

Each copy picks its template by the domain of its entity.
See Using Templates for how the choice is made and what happens to a domain with no entry.
Grid options in sections views
A card’s grid_options are passed through to the layout, so templated cards size
themselves exactly as they would if you had written them inline.
Combine that with a variable and the width becomes part of the template’s interface:
decluttering_templates:
sized_tile:
card:
type: tile
entity: '[[entity]]'
name: '[[name]]'
hide_state: true
grid_options:
columns: '[[cols]]'
rows: 1
default:
- cols: 6
- type: custom:decluttering-card-plus
template: sized_tile
variables: [{ entity: sensor.solar_power, name: Solar, cols: 12 }]
- type: custom:decluttering-card-plus
template: sized_tile
variables: [{ entity: sensor.house_power, name: House, cols: 6 }]
- type: custom:decluttering-card-plus
template: sized_tile
variables: [{ entity: sensor.kitchen_temperature, name: Kitchen, cols: 4 }]

Six cards from the three widths above: cols: 12 for Solar, 6 for House and Lounge,
and 4 for Kitchen, Bedroom and Hall.
'[[cols]]' is a whole value, so the number stays a number — see
Variables.
This only works inside card:. A grid_options beside card: at the top of the template,
or on the custom:decluttering-card-plus card, sizes the card too and wins over the one
inside, but it is taken as written, with no placeholders filled. See
Styling.
Cards that use the older layout API are supported too; whichever one the wrapped card implements is the one that gets reported.
Cards that resize themselves
A card set to fill its container — a tile with vertical: true in a fixed-height grid, for
example — measures itself against the space the layout gave it, not against the wrapper.
Templated cards behave the same as inline ones here.
Cards that hide themselves
If the wrapped card hides itself — through visibility conditions, a conditional card with
no matching condition, an inline style, a stylesheet rule or the hidden attribute — the
wrapper collapses with it and leaves no gap in the layout.
See Visibility.
Dividers
type: divider inside an Entities card is technically a row rather than a card. It is
handled correctly whichever key you put it under.
When a card cannot be built: the error card (v2.9.0+)

A card that cannot be built used to show Home Assistant’s red error box with one sentence in it. It now shows a card that says which template, points at the line that failed, and offers the fix. There are four kinds:
| What went wrong | What it shows |
|---|---|
| The template does not exist | template: room_ligth_tile ← not found, and the nearest name with how many cards here use it: Did you mean room_light_tile? It is used by 2 other cards here. |
| The card the template builds is not installed | type: custom:mini-graph-card ← not registered, and Install it from the Marketplace (or HACS), or pick another card in the template. |
| A variable is unset and the card is strict | entity: ← (unset) has no value |
A template’s check failed at level error under strict |
The check’s own message |

While the dashboard is in edit mode, an administrator gets buttons under it:
- Use room_light_tile points the card at the nearest name and saves. Like every rewrite, it can be undone from the toast.
- Fix in editor opens the card’s own editor. For an unset variable the button names it: Set entity.
- Open template, for a card that is not installed, opens the template’s editor, where the card type is.
- Show what was passed shows the card’s
variables:as YAML, and the full error message folded under Details.
Outside edit mode, and for anyone who is not an administrator, it is the message and the line only.
Some things keep the plain red alert:
- A row, a badge or a picture element. There is no room in an entities card’s row or a badge for a card’s worth of explanation.
- In a sections view in edit mode, the card shows without its buttons. Home Assistant lays its edit overlay over every card there, so the buttons could never be clicked; the card’s own Edit does the job.
- A card inside a stack has no address of its own for Fix in editor, so that button is left out; open the stack instead.
A card with on_error: shows
what that asks for, as before. The error card is what you get when it asks for nothing.
While a card is on its way (v2.9.0+)
A card that is not ready to build yet holds its place with a plain block, the colour of a card and slightly dimmed, instead of taking no room and pushing everything up when it lands. That happens while a borrowed template is being fetched, while the card waits for Home Assistant, for a lazy copy not yet near the screen, and for a card waiting for idle time (below).
In a sections view the block is as tall as the card’s or the template’s grid_options asks
for, so the layout is final from the first paint. A card that asks for no height holds one
row. In a masonry view it holds the height of an ordinary card. A theme can change its look:
see Styling.
Cards off the screen build later (v2.9.0+)
In a sections view, a card that is off the screen when the page lays out does not build straight away. It holds its place, the cards you can see build and paint first, and it builds in the browser’s idle time, two seconds later at the most, so it is there by the time you scroll to it. The work is the same; it is moved behind the first paint, which matters on a view with dozens of templated cards and a slow tablet.
Some cards never wait:
- every card in a masonry view. Masonry lays its columns out from each card’s real size, so a card that waited would hold up the ones on screen too;
- a card in an edit dialog or a preview;
- a card with
debug:set, includingdebug: report, since the build is the point; - a
group:template, which the section lays out a card at a time; - a card that has built before: a rebuild on a state change or a section move is immediate.
There is nothing to set. To see which builds waited, the browser’s performance tools show a
mark, decluttering-card-plus:idle-build, for each one.
A card for the dashboard’s health (v2.9.0+)
custom:decluttering-card-plus-health-card lists every card on the dashboard pointing at a
missing template, leaving a variable unset or using a deprecated template, with a button to
open each. See The Health Card and Badge.
Reference
The keys this page uses. A template can carry more (let:, description:, name:,
publish: and others), and so can the card.
| Key | Where | Description |
|---|---|---|
card: |
template | The card configuration, with [[variables]] |
group: (v1.14.0+) |
template | In place of card:: a list of cards laid out on the section’s grid, written under cards: or as a bare list — see above |
default: |
template | Fallback variable values, as a list (- name: value) or a mapping |
style: |
template | CSS to inject — see Styling |
grid_options: (v1.2.0+) |
template | The size in a sections view for every card using the template. Placeholders are not filled here — see Styling |
extends: (v1.8.0+) |
template | A template, or (v2.0.0+) a list of them, to start from — see Defining Templates |
deprecated: (v2.0.0+) |
template | true, or a message saying what to use instead — see Defining Templates |
examples: (v2.0.0+) |
template | Variable sets the template is checked and previewed with — see Defining Templates |
on_error: (v2.0.0+) |
template or instance | A card to show, or hide, when building fails; the instance’s wins — see Using Templates |
template: |
instance | Name of the template |
template_by_domain: (v2.0.0+) |
instance | A template per entity domain, plus default: — see Using Templates |
variables: |
instance | Values to substitute, as a list (- name: value) or a mapping |
card: (v1.12.0+) |
instance | Laid over what the template builds, as written; lists can be edited with __append__ and co (v2.0.0+) — see Using Templates |
style: |
instance | Extra CSS, appended after the template’s |
grid_options: (v1.2.0+) |
instance | The size in a sections view; beats the template’s. Placeholders are not filled here |
fit: (v1.1.0+) |
instance | contents gives up the card’s own box — see Styling |
for_each:, for_each_from: |
instance | One copy of the template per item, or per thing Home Assistant knows about — see Repeating a Template |
empty: (v1.2.0+) |
instance | A card to show when a repeat makes no copies. Used exactly as written: placeholders in it are not filled |
Every key, with an example of each, is in the Configuration Reference.