AhaSlides Design
v0.52.0React · Vue · Lit

Patterns · Settings

Card select

Single-select as an icon+label card grid — pick one of N options each shown as its own visual card, with roving radiogroup keyboard navigation. Two layouts: labelled tiles (stretch to fill `columns`) or compact 44px icon-only squares.

Examples

Columns
Icon only
Single-select card grid — Tab in, then Arrow keys move-and-select
Icon only — compact 44px squares (label kept as title + aria-label)
Disabled

API

PropTypeDefaultNotes
optionsArray<{value,label,icon}>[]The cards — each an icon name + a label; set as a property or a JSON attribute
valuestringThe selected option's value (single-select)
columnsnumber3Grid column count — labelled tiles fill each track; iconOnly lays out that many 44px squares
iconOnlybooleanfalseCompact layout — fixed 44px icon squares packed to the start; the label is hidden but kept as title + aria-label
disabledbooleanfalseNon-interactive; grey fill
changeCustomEvent<{value}>Composed event on selection; read e.detail.value

Install

# .npmrc — once: point the @ahaslides-product scope at GitHub Packages
@ahaslides-product:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}   # a GitHub token with read:packages

npm i @ahaslides-product/design
import '@ahaslides-product/design/tokens.css';   // once, at the app root
import '@ahaslides-product/design/aha-card-select';   // registers <aha-card-select>

Agent feed for this component (absolute, fetchable anywhere): card-select.agent.json · card-select.md · card-select.llms.txt

When to use

When to use
  • Card select — pick one of N options, each carrying a visual (icon/preview) — a chart-type, layout or mode picker
  • Segmented — 2–4 short text-only options in one row (SETTINGS-38)
  • Select — a longer or space-constrained set with no per-option visual
Reach for CardSelect only when each option carries a visual. Do not hand-roll a grid of bespoke <button>/<div> tiles with inline <svg> icons and a manual selected state (SETTINGS-51) — the roving radiogroup a11y is the hard part and it lives here.
Surfaces
editor settings

Spec

Card icon 24 over label; padding 16 12; radius 8; 1px #D4D4D4 border · Grid repeat(columns, minmax(0,1fr)) — tiles stretch to fill; columns default 3; 8px gap · iconOnly repeat(columns, 44px) — fixed 44px squares packed to the start; label hidden, kept as title + aria-label · Selected #6A1EBB border + #F9F5FF tint + #6A1EBB label/icon (persistent node) · Hover #D3B4FF border · Keyboard roving radiogroup — one tab-stop; Arrow keys move-and-select; Space/Enter select · Disabled #F1F1F1 fill, #EBEBEB border, not-allowed