Template variables¶
Template variables are the values that are allowed to change between instances of the same card template. They let one reusable design accept a different entity, label, scale, list, or configuration block without duplicating the complete card.
This page shows how to define placeholders, give them defaults, supply values from a card instance, and pass larger lists or mappings when needed.
Add a variable to a template¶
Use a descriptive placeholder where the value is needed:
A placeholder without a default must be supplied by the card instance.
Supply values when using the template¶
Template variables let one reusable card structure receive the entity names, text, or other values that differ per use.
The default unit remains in use because this instance does not replace it.
Pass a list or configuration block¶
A variable can also contain a list or map:
Use variables only for differences between instances¶
Use a variable when the value is supplied when the card is created. Use a JavaScript template when the value should change later with an entity state.