Expanding Cards
A horizontal strip of panels that expand on click/focus — one stays wide while the others stay slim. Use ← → when a panel is focused. Great for featured galleries and showcases where you want one focal item at a time.
Photo strip
Uses a background image on each .vd-expanding-card via --vd-expanding-card-bg.
Solid brand colors
Set --vd-expanding-card-bg to a flat color (and --vd-expanding-card-bg-default so the icon circle matches).
Attribution
Interaction and layout are adapted from the MIT-licensed CodePen “Expanding flex cards” by Zed Dash. VD3 UI adds prefixed class names, documentation, optional keyboard navigation, and reduced-motion handling. Photo strip images are VD3 UI demo assets.
Engine wiring
API Reference
| Class / Variable | Description |
|---|---|
.vd-expanding-cards | Container. Add data-vd-expanding-cards to enable it. |
.vd-expanding-card | A panel. The active one expands; others slim down. |
.vd-expanding-card.is-active | Sets the initially expanded card. |
--vd-expanding-card-bg | Per-card background (url(...) or a color). |
--vd-expanding-card-bg-default | Icon-circle background for solid-color cards. |
.vd-expanding-card-label | Overlay holding the icon + title + subtitle. |
Accessibility
- Each card is focusable; arrow keys move between cards and Enter/Space expand the focused card.
- The active card carries
aria-pressed="true"; the othersaria-pressed="false". - Background photos are decorative — the title/subtitle provide the accessible label.