Components
Card
Glass surfaces with an optional wash of the item’s own color.
Surface and glass#
Surface card
A solid surface. In dark theme it is the near-black surface token, in light it is white with a visible edge.
Glass card
A translucent layer with a blur behind it, from the glass token.
<article class="ha-card dm-card">
<h3 class="ha-card__title">Surface card</h3>
<p class="ha-card__text">A solid surface. In dark theme it is the near-black surface token, in light it is white with a visible edge.</p>
</article>
<article class="ha-card ha-card--glass dm-card">
<h3 class="ha-card__title">Glass card</h3>
<p class="ha-card__text">A translucent layer with a blur behind it, from the glass token.</p>
</article>Corner color wash#
Set --ha-cor on the card to its own color. The wash, the badge, and the status dot all follow it.
HomeLab
LiveA Kubernetes cluster at home, documented from the first node.
Portfolio
Technical challengeA personal site with particles, a dialog CV viewer, and three languages.
<article class="ha-card ha-card--glass ha-card--wash dm-card" style="--ha-cor:#14b8a6">
<div class="ha-card__header">
<span class="ha-icon-tile"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.500h.01M7 16.500h.01"/></svg></span>
<div><h3 class="ha-card__title">HomeLab</h3><span class="ha-badge ha-badge--live">Live</span></div>
</div>
<p class="ha-card__text">A Kubernetes cluster at home, documented from the first node.</p>
<div class="ha-card__footer"><span class="ha-tag">k3s</span><span class="ha-tag">Traefik</span></div>
</article>
<article class="ha-card ha-card--glass ha-card--wash dm-card" style="--ha-cor:#ff4d00">
<div class="ha-card__header">
<span class="ha-icon-tile"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 5l-4 14"/></svg></span>
<div><h3 class="ha-card__title">Portfolio</h3><span class="ha-badge ha-badge--challenge">Technical challenge</span></div>
</div>
<p class="ha-card__text">A personal site with particles, a dialog CV viewer, and three languages.</p>
<div class="ha-card__footer"><span class="ha-tag">React</span><span class="ha-tag">TypeScript</span></div>
</article>Interactive#
Add ha-card--interactive, and put one link with ha-card__link on the title. Its pseudo-element covers the whole card, so the card is one big target with one tab stop. The card shows the focus ring when the link has focus.
Open the case study
Hover lifts the card by 3px. Under reduced motion it does not move.
<article class="ha-card ha-card--glass ha-card--wash ha-card--interactive dm-card" style="--ha-cor:#ff8c42">
<h3 class="ha-card__title"><a class="ha-card__link" href="#card" style="color:inherit;text-decoration:none">Open the case study</a></h3>
<p class="ha-card__text">Hover lifts the card by 3px. Under reduced motion it does not move.</p>
</article>Equal-height grids#
ha-card-grid fills the width with columns at least --ha-card-min wide and stretches every card to the row height. Add ha-card-grid--rows with --ha-card-rows on browsers with subgrid, so the header, text, and footer of neighboring cards line up on shared rows. Without subgrid the cards fall back to a flex column with the footer pushed to the bottom.
Short
One line.
A much longer title that wraps
A longer body that takes several lines so you can see the footers stay aligned across the row.
Medium
Two lines of text here.
<ul class="ha-card-grid ha-card-grid--rows" style="--ha-card-rows:3;--ha-card-min:220px" role="list">
<li><article class="ha-card ha-card--glass"><h3 class="ha-card__title">Short</h3><p class="ha-card__text">One line.</p><div class="ha-card__footer"><span class="ha-tag">a</span></div></article></li>
<li><article class="ha-card ha-card--glass"><h3 class="ha-card__title">A much longer title that wraps</h3><p class="ha-card__text">A longer body that takes several lines so you can see the footers stay aligned across the row.</p><div class="ha-card__footer"><span class="ha-tag">b</span></div></article></li>
<li><article class="ha-card ha-card--glass"><h3 class="ha-card__title">Medium</h3><p class="ha-card__text">Two lines of text here.</p><div class="ha-card__footer"><span class="ha-tag">c</span></div></article></li>
</ul>| Class | Purpose |
|---|---|
ha-card, --glass, --wash, --interactive | Card and modifiers. |
ha-card__header, __title, __text, __footer, __badge, __link | Parts. |
ha-card-grid, --rows | Equal-height grid, with optional subgrid rows. |
--ha-cor | The item color for the wash, badge, and dot. |
Accessibility#
- Text on glass cards is tested on the composite over the canvas: text, muted, and accent-text all reach 4.5:1.
- Use a heading in each card and a list for the grid so screen reader users get a count.
- The wash is decorative and sits behind the content at low alpha.