Icon¶
The Icon tool adds a visual symbol to a card. It can use the icon Home Assistant already knows for an entity, another MDI icon, or an external SVG/image, and it can also change with the entity state.
This page shows how to choose the icon source, size and align it, rotate it, change it by state, and apply fixed or value-based colors.
Show the entity icon¶
Use the Icon tool when the Home Assistant entity icon provides a compact visual identity for the item.
Choose another icon¶
Override the icon when the Home Assistant default does not represent the purpose of this card clearly enough.
Use an image or SVG¶
For a Home Assistant/MDI icon, set icon to its icon name, for example mdi:thermometer. For an external SVG or image, use CSS-style url(...) syntax. A URL ending in .svg is loaded as SVG; other URLs are shown as images.
Keep the source in the same Icon tool so its size, position, and alignment remain together.
Change size and position¶
Adjust size and position when the icon needs to fit the surrounding text, gauge, or control.
align controls where the icon is anchored around its position: center centers it on the configured position, start anchors its start side there, and end anchors its end side there. Rotate the icon¶
Rotate an icon when direction itself carries meaning, such as an arrow or orientation indicator.
Change the icon by state¶
Use state_map when different entity states should use different icons. This keeps the state-to-icon choices together with the Icon tool.
Change the icon color¶
Use styles for a fixed appearance or color_stops when the color should follow the entity value/state.
Configuration options¶
Required applies to the specific form described by that table: Yes means you need the field for that form; No means you can leave it out. Not set means the card adds no explicit value when the option is omitted.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
xpos, ypos | number | Yes | — | Position of the icon. |
entity_index | entity index | No | 0 for an entity-derived icon; otherwise Not set | Chooses the entity whose icon and state are used. If you do not configure icon or state_map, omitting this field uses the first configured entity. |
icon | string | No | Entity icon | Home Assistant/MDI icon name such as mdi:thermometer, or an external SVG/image in url(...) form. |
size | number | No | 2 | Font-based icon-size multiplier used when neither icon_size nor icon_size_percent is set. |
icon_size | number | No | Not set | Font-based icon-size multiplier. It overrides size. |
icon_size_percent | number | No | Not set | Geometric icon size on the card's 100-unit scale. It overrides both icon_size and size. |
align | start, center, end | No | center | Anchors the icon by its start side, center, or end side. |
rotate | number | No | 0 | Rotation in degrees. |
state_map | mapping | No | Not set | Changes icon from entity state. |
styles | mapping | No | Default icon style | Icon appearance. |
color_stops | mapping | No | Not set | Changes color from entity value/state. |