Custom Cards in Home Assistant: Mushroom and button-card
The stock cards in Home Assistant get you a working dashboard in an afternoon. I wrote that one up in five build steps and left it there for a while. What they do not give you is control over typography, over how a number is drawn, or over a ring that shows a battery level. For that you need custom cards, and this post is about the four I ended up with, the theme that holds them together, and the…
Home Assistant's stock cards, while functional, lack control over typography, number display, and battery level indicators. Custom cards are necessary for these features, and this post covers four such cards: card-mod (CSS injection), Mushroom (compact tile cards), mini-graph-card (line charts), and button-card (JavaScript rendering).
The setup was reproducible without HACS, with custom card bundles placed under www/cards and loaded from configuration.yaml. Fonts are crucial for readability, and a theme cannot declare fonts directly. Instead, a tiny ES module enforces the typography by appending @font-face rules to the document head. This approach allows using Archivo for labels and IBM Plex Mono for values.
The Mushroom template cards are used for values, with primary and secondary text, icons, and icon colors. Card-mod enforces the typography for these cards, ensuring consistent styling across eleven template cards in the dashboard. The battery status is displayed as an SVG ring, showing charge level and switching colors at 60% and 25%. The custom field in button-card handles the computation based on the sensor state.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.