Choice cards specification: GhostRadioCard and GhostCheckboxCard
Important
Status: Approved on 2026-12-01 by zprue743, after every change from the first review was applied, recorded in PR #704. This is design approval only, not merge approval of any implementation or release inclusion. The build ships both cards as experimental; see the radio group and checkbox group pages.
Purpose and user problems
"Pick one of these cards" is a common form pattern: a room, a plan, a shipping speed, a workspace template. Each option is a bordered surface with a title, a line or two of detail, and a visible selected state. The whole surface is the click target.
GhostVue has no part for it today. An app that built a room chooser on 0.2.0 did this:
<GhostRadioGroup v-model="room" name="room">
<GhostCard v-for="room in rooms" :key="room.id">
<GhostRadioGroupItem :id="`room-${room.id}`" :value="room.id" />
<label :for="`room-${room.id}`">{{ room.name }}</label>
<p>{{ room.detail }}</p>
</GhostCard>
</GhostRadioGroup>Three things go wrong:
- Only the radio and its
<label>text respond to a click. Clicking the card's padding, its detail line, or its price does nothing. - The card has no selected state of its own. The app writes CSS against the radio's
data-statewith:has(), and each app writes it differently. - Forced colors drop the app's selected background, so the only remaining cue is the small radio dot.
GhostRadioCard and GhostCheckboxCard are card-shaped members of the existing groups. Each renders a native <label> around the group's native input, so the whole card activates the input with no script. Each mirrors the input's state onto the card. The groups keep their model, form, reset and keyboard behavior unchanged, because the input inside the card is the same GhostRadioGroupItem or group-member GhostCheckbox the groups already manage.
Non-goals
- No change to group behavior.
GhostRadioGroupandGhostCheckboxGroupkeep their props, models, keyboard, form submission and reset. A card is another member, nothing more. - No
variant="card"on the existing items.GhostRadioGroupItemand group-memberGhostCheckboxrender a void<input>and expose it aselement. A card needs a wrapping element and slots, which would change both contracts (see Design decision). - No standalone checkbox card.
GhostCheckboxCardmust sit insideGhostCheckboxGroup. A single boolean card ("I agree to the terms") is a plainGhostCheckboxin a label. - No interactive content inside a card in v1. HTML forbids other labelable controls (buttons, inputs, selects) inside a
<label>. Links are valid there, but a link inside a card follows the link instead of choosing the card, and adds a second tab stop to a radio card. v1 does not support links either. "View photos" or "Compare plans" actions go outside the card. - No hidden indicator in v1. The radio dot or check mark always shows. It is the selected cue that does not depend on color.
- No
asprop. The root must be a<label>for native activation. - No indeterminate card. A mixed "select all" stays a plain
GhostCheckbox, as the checkbox group spec describes. - No roving focus, arrow keys for checkboxes, or grid navigation across cards. Keyboard behavior comes from the native inputs.
- No layout component. Arranging cards in a grid or row is consumer or themed CSS on the group root.
- No visual styling in
@ghostvue/vue. Borders, padding and the selected appearance live in@ghostvue/themes.
Design decision
Three shapes were compared against the same five checks.
| Shape | Whole-card click target | Selected, focus and disabled in forced colors | Disabled state | Group keyboard unchanged | Public API cost |
|---|---|---|---|---|---|
A. New GhostRadioCard and GhostCheckboxCard parts (chosen) | Yes. The root is a native <label> around the input. | Yes. The card root carries data-state and data-disabled, so the theme draws a border-width change and system colors on the card itself, plus the indicator's existing forced-colors marks. | Native disabled on the input, plus data-disabled on the card root for the card's own style. | Yes. The input is the existing group member. | Two new parts, each with value, disabled, two slots and four exposed members. One listener fallthrough fix on GhostRadioGroupItem; no other change to existing parts. |
B. variant="card" on GhostRadioGroupItem and on group-member GhostCheckbox | Only if the variant changes the root from <input> to <label>. | Yes, once the root changes. | The same as A, once the root changes. | Yes. | The variant changes what element returns, where fallthrough attributes land, and whether the void part has slots. A prop that swaps the root element is two components behind one name. |
C. Documented recipe: GhostCard with as, a wrapping <label>, and the item inside | Partly. GhostCard allows only div, article, section, aside, a and button roots, so the recipe wraps the card in a <label>. Its header and content divs are then invalid inside a <label>. | Only with app CSS such as :has(:checked). That CSS is what the feedback asked to remove. | Native disabled on the input; the card's disabled look is app CSS such as :has(:disabled). | Yes. | None, but every app repeats the markup and the selected styles. |
Shape A is the only one that gives the card a selected state of its own without changing an existing contract. It reuses the item and member logic instead of copying it.
Public API
Package boundary and exports
@ghostvue/vue:
GhostRadioCard: card member ofGhostRadioGroup. Renders a<label>root and aGhostRadioGroupIteminside it.GhostCheckboxCard: card member ofGhostCheckboxGroup. Renders a<label>root and a group-memberGhostCheckboxinside it.- Types:
GhostRadioCardProps,GhostRadioCardExposed,GhostCheckboxCardProps,GhostCheckboxCardExposed. - No new composable. The cards read the existing internal group contexts to mirror
data-stateanddata-disabledonto the root. No context key, provider or helper is exported.
@ghostvue/themes:
GhostRadioCard,GhostCheckboxCard: thin wrappers in the same pattern as the themedGhostRadioGroupItem. They add no props in v1. Styles live in newghost-radio-card.cssandghost-checkbox-card.cssrecipes that read existing semantic tokens (see Rendering and customization).
No code is added to @ghostvue/core.
Props and configuration
GhostRadioCard
| Prop | Type | Default | Contract |
|---|---|---|---|
value | string | (required) | Passed to the inner GhostRadioGroupItem. Same rules as the item's value: stable, unique in the group, and the submitted value. |
disabled | boolean | false | Passed to the inner item. The card is disabled when this or the group's disabled is true. |
GhostCheckboxCard
| Prop | Type | Default | Contract |
|---|---|---|---|
value | string | (required) | Passed to the inner GhostCheckbox as its member value. Same rules as a checkbox group member: an opaque string, typed by the group. |
disabled | boolean | false | Passed to the inner checkbox. The card is disabled when this or the group's disabled is true. |
Both cards throw during setup when no matching group is above them, with the same wording as GhostRadioGroupItem: GhostRadioCard must be used inside GhostRadioGroup and GhostCheckboxCard must be used inside GhostCheckboxGroup.
Attribute fallthrough
Both cards set inheritAttrs: false and split attributes so a card can replace an item without moving its wiring:
class,styleanddata-visual-statego to the<label>root.- Everything else goes to the inner input, through the inner item's own fallthrough rules:
id,name(checkbox only, with the existingGHOST017warning when it differs from the group's),aria-*, otherdata-*, and listeners such as@change,@focusand@blur. GhostRadioGroupItemcurrently drops a consumeronChangeinstead of chaining it, although the radio group spec says listeners attach to the input. The build fixes the item to call a consumeronChangeafter its own handler, so@changeworks on both the item and the radio card. This is a bug fix, not a contract change.GhostCheckboxCarddoes not forwardindeterminate; it is dropped, so the input and the card root cannot disagree.modelValue,defaultValueandonUpdate:modelValueare forwarded only so the existingGHOST016warning fires; as on any group member, they have no effect.- A consumer
aria-labelledbyreplaces the card's generated one. A consumeraria-describedbyis joined after the generated description id, separated by a space. - A consumer
aria-labelis not supported, because the generatedaria-labelledbytakes precedence over it. Name a card with the default slot or witharia-labelledby. formon a checkbox card is dropped with the existingGHOST015warning, as for any group member.
v-model contracts
None on the cards. The owning group's v-model is the only model:
GhostRadioGroup:string | undefined, controlled or uncontrolled, withdefaultValueand form reset as its spec defines.GhostCheckboxGroup:readonly TValue[], controlled or uncontrolled, withdefaultValueand form reset as its spec defines.
A card never emits a model update itself. Its inner input does, through the group, exactly as a plain item or member would. When the parent ignores a controlled update, the group's existing restore step puts the input back, and the card's data-state follows the group's state, not the DOM checked property.
Events, slots, and exposed methods
No component-specific events. Native change, input, focus and blur on the inner input reach listeners passed to the card (see Attribute fallthrough). A click listener passed to the card also lands on the input, which receives the synthetic click the label dispatches, so it fires once per activation.
| Slot | Part | Required | Contract |
|---|---|---|---|
default | label | Yes | The option's accessible name. Rendered in a <span data-part="label"> whose id the input references with aria-labelledby. Phrasing content only. |
description | description | No | Supporting detail. Rendered in a <span data-part="description"> only when the slot is provided, and its id is added to the input's aria-describedby. Phrasing only. |
Slot content must be phrasing content (text, strong, em, img, GhostBadge and other span roots) and must not contain interactive elements, because both slots sit inside a <label>. Use CSS (display: block or grid) for layout inside a card rather than block elements. The build does not check this at runtime; the docs and examples state it, the same way the card spec handles nested interactives in action roots.
Exposed template ref, the same shape on both cards:
| Member | Type | Contract |
|---|---|---|
element | HTMLLabelElement | null | The card root after mount. Matches the repository convention that element is the root. |
inputElement | HTMLInputElement | null | The inner radio or checkbox input after mount. |
focus | (options?) => void | Focuses the inner input. A disabled input does not take focus, as with the items. |
blur | () => void | Blurs the inner input. |
State model
A card has no state of its own. It mirrors its input's group state on the root:
| Condition | Root data-state | Root data-disabled | Input |
|---|---|---|---|
| Selected (radio) or checked (checkbox) | checked | omitted | checked, data-state="checked" (existing item hooks) |
| Not selected | omitted | omitted | not checked |
Card disabled or group disabled | as above | "" | native disabled |
| Selected and disabled | checked | "" | checked and disabled |
The root data-state is computed from the same group state the input's data-state uses (isSelected for both groups), so the two never disagree after a render. The root uses data-disabled rather than a second data-state value so a selected disabled card keeps both hooks.
data-disabled reflects only the card's and the group's disabled props. An input can also be disabled by an ancestor <fieldset disabled> (for example a consumer fieldset or GhostFieldset) without either prop. The themed disabled style therefore matches [data-disabled] or :has(> input:disabled), so such a card looks and behaves disabled, as plain items already do through :disabled.
Loading, empty, disabled, read-only, and error states
- Disabled. Clicking a disabled card does nothing, because a
<label>does not activate a disabled input. A disabled card is not a tab stop. A selected disabled card does not submit its value, because native forms omit disabled controls. The cards do not change that. - Invalid. The group's
invalidprop keeps marking only the group root (aria-invalid="true",data-state="invalid"). The themed recipe draws unselected cards inside an invalid group with the danger border so the error is visible on the cards, not only on the group. Cards themselves get noaria-invalid. - Read-only, loading, empty. Not supported by either group, and the cards add none. An empty group with no cards renders nothing extra.
Async behavior
None. Activation and state are synchronous through the native input and the group.
Accessibility contract
Semantics and relationships
- Root: native
<label>. It has no role and is not focusable. - Control: the inner native
<input type="radio">or<input type="checkbox">, unchanged from the existing items. Radio cards share the group'sname(explicit or generated), so they form one native radio group. - Name:
aria-labelledbyon the input points at thelabelpart, so the name is only the default slot's text. Without it, the wrapping<label>would make the name the whole card's text, description included. - Description: when the
descriptionslot is used, its id joins the input'saria-describedby. - Group: unchanged. A
fieldsetroot with alegend(oraria-labelledby) names the group of cards, andGhostFieldwiring works as it does for items.
Keyboard interaction
Unchanged from the groups, because the focus target is the same native input.
| Key | GhostRadioCard in GhostRadioGroup | GhostCheckboxCard in GhostCheckboxGroup |
|---|---|---|
Tab / Shift+Tab | One tab stop for the group: the selected card's input, else the engine's native entry point. | One tab stop per enabled card. |
ArrowDown / ArrowRight | Moves to the next enabled card and selects it (RTL mirroring per engine, as documented). | No effect. |
ArrowUp / ArrowLeft | Moves to the previous enabled card and selects it. | No effect. |
Space | Selects the focused card when it is not selected. | Toggles the focused card. |
Enter | Submits the owning form when it has one (native). | Submits the owning form when it has one (native). |
The per-engine differences recorded in the radio group spec (RTL arrows in WebKit, backward Tab into an unselected group) apply to cards unchanged.
Focus behavior
- Focus stays on the native input. The card does not move or trap focus.
- Clicking a card focuses its input in engines that focus inputs on label click. The theme draws focus on the card root when the input matches
:focus-visible, so pointer clicks do not show a focus ring where the engine does not report:focus-visible. - Inside a card, the theme draws the focus ring on the card instead of the indicator, so one ring shows.
- Disabled cards are skipped by Tab and by radio arrow keys, as their inputs are.
Assistive technology expectations
A screen reader reaching a radio card announces the input role, the default slot text as its name, its checked state, its position in the group (2 of 4 where supported), and the description. For example: "Ocean suite, radio button, checked, 2 of 4, King bed, sleeps 2, 240 dollars a night". A checkbox card announces "Late checkout, checkbox, not checked, Leave at 2 PM, 30 dollars". The card's border and background add nothing to the announcement.
Manual assistive-technology checks (NVDA with Firefox, VoiceOver with Safari) are planned for the build issue, as for other experimental components. No manual results are recorded in this spec.
Rendering and customization
Markup
Rendered shape, for reference. Wrapper nesting beyond these hooks is not API.
<label class="ghost-radio-card" data-part="root" data-state="checked">
<input
type="radio"
class="ghost-radio-group-item"
name="room"
value="ocean"
aria-labelledby="ghost-radio-card-label-…"
aria-describedby="ghost-radio-card-description-…"
…
/>
<span data-part="label" id="ghost-radio-card-label-…">Ocean suite</span>
<span data-part="description" id="ghost-radio-card-description-…">
King bed · Sleeps 2 · $240 a night
</span>
</label>GhostCheckboxCard is the same with class ghost-checkbox-card and an inner input.ghost-checkbox.
Stable hooks
- Root classes
ghost-radio-cardandghost-checkbox-card. - Root
data-part="root",data-state="checked"(or omitted) anddata-disabled(or omitted). - Parts
data-part="label"anddata-part="description"on the two spans. - The inner input keeps its existing class and hooks (
ghost-radio-group-itemorghost-checkbox, itsdata-partanddata-state). data-visual-stateon the root (hover,focus-visible,active) for the docs and visual-test state galleries, as on other themed parts.
Themed appearance
The themed recipes reuse the GhostCard surface tokens and the existing indicator styles. No new public tokens.
- Layout. A grid with the indicator in the first column (inline-start, aligned to the first line of the label) and the label and description stacked in the second. Card padding uses
--ghost-space-inset-md; the description uses the muted foreground and a smaller type step. The card fills its grid or flex track; arranging cards is the group root's layout (vertical stack by default,orientation="horizontal"wraps them in a row). - Size. The cards add no
sizeprop in v1. Inside a themed group withsize="sm"orsize="lg", only the indicator follows the group size, through the existing--_ghost-radio-hitwiring for radio cards and the indicator box for checkbox cards. Card padding and type stay the same at every size. - Resting. Card background
--ghost-elevation-1-bg, hairline border--ghost-elevation-1-border, radius--ghost-radius-md,cursor: pointer. - Hover. Background mixed with
--ghost-state-layer-hover, as the checkbox hover fill is. - Selected. Border color
--ghost-border-primaryand border width doubled from the hairline, with padding reduced by the same amount so the content does not shift. Background mixed with--ghost-state-layer-selected. The indicator shows its existing dot or check mark. - Focus visible. The card root draws the standard focus ring (
--ghost-focus-ring-*outline and offset) when its input is:focus-visible. The indicator's own ring is suppressed only by the same:has(> input:focus-visible)rule that draws the card ring, so in an engine without:has()the indicator ring remains and focus stays visible. - Disabled.
cursor: not-allowedand--ghost-action-disabled-opacityon the whole card, matching the radio item. Matches[data-disabled]or:has(> input:disabled)(see State model). - Invalid group. Unselected cards inside an invalid group use
--ghost-border-danger. - Dark mode. No separate rules: every value above is a semantic token that already has a dark value.
- Forced colors. The card keeps forced color adjustment, so system colors replace the backgrounds. The selected state survives as three non-background cues: the doubled border width, a
Highlightborder color, and the indicator's existingHighlightdot or check. Focus is aHighlightoutline on the card. Disabled cards use aGrayTextborder and text, at full opacity. - Reduced motion. Border and background transitions use the instant duration, as the checkbox does.
The themed recipes use :has(), as the button and collapsible recipes already do, for the card focus ring (.ghost-radio-card:has(> input:focus-visible)) and as the second match for the disabled style. Selected styles read the root's own data-state.
Environment behavior
SSR and hydration
- Ids for the
labelanddescriptionspans come fromuseGhostId, which is SSR-stable, soaria-labelledbyandaria-describedbymatch between server and client. - The root
data-stateis rendered on the server from the group's initial model (modelValueordefaultValue), so the selected card is styled before hydration. The input'scheckedattribute is rendered the same way the items render it today. - The description span renders only when the slot exists on both server and client. No browser API is read during setup.
Mobile and touch
- The whole card is the touch target, so it is far larger than the
--ghost-control-size-*minimum. - A tap on the label, the description or the padding activates the input natively. There is no gesture and no hover-only information.
- A tap does not open the virtual keyboard: the input is a radio or checkbox.
Performance
A card adds one root element, one or two spans, two ids and one computed state read from the group's existing reactive state. Typical use is two to a dozen cards. No virtualization is planned; a long list of choices belongs in a GhostSelect or GhostCombobox. The cards do not copy or watch the group's model beyond the existing isSelected read.
Composition
GhostRadioCardrendersGhostRadioGroupItem. It reuses item registration, disabled handling, controlled restore, form reset and the generated groupname.GhostCheckboxCardrenders a group-memberGhostCheckbox. It reuses member registration, the array model, theGHOST015,GHOST016andGHOST017development warnings, and member form reset.- Both inject the existing internal group context keys only to compute the root's
data-stateanddata-disabled. useGhostIdfor thelabelanddescriptionids.- They do not use
GhostCard. A card's root must be a<label>, whichGhostCarddoes not offer, andGhostCard'sdivparts are not valid label content. The themed recipes reuse the card's surface tokens instead. - They do not use
useRovingFocus,useFocusScopeoruseGhostInteractiveSurface.
Spec amendments in this change
- Radio group spec: the non-goal "Card-style or button-role toggles" now points card-style choices to
GhostRadioCardand keeps button-role toggles withGhostToggleGroup. - Checkbox group spec: a note that
GhostCheckboxCardis a supported member alongsideGhostCheckbox. - Card spec: the non-goal "Card selection" points to the choice cards.
Room chooser traces
Single choice with GhostRadioGroup
<script setup lang="ts">
import { ref } from 'vue'
import { GhostRadioCard, GhostRadioGroup } from '@ghostvue/themes'
interface Room {
id: 'garden' | 'ocean' | 'loft' | 'family'
name: string
detail: string
soldOut?: boolean
}
const rooms: readonly Room[] = [
{
id: 'garden',
name: 'Garden room',
detail: 'Queen bed · Sleeps 2 · $160 a night',
},
{
id: 'ocean',
name: 'Ocean suite',
detail: 'King bed · Sleeps 2 · $240 a night',
},
{
id: 'loft',
name: 'Loft',
detail: 'Two queens · Sleeps 4 · $280 a night',
soldOut: true,
},
{
id: 'family',
name: 'Family suite',
detail: 'King and bunks · Sleeps 5 · $320 a night',
},
]
const room = ref<string | undefined>('ocean')
</script>
<template>
<GhostRadioGroup
v-model="room"
default-value="ocean"
name="room"
class="room-grid"
>
<legend>Room</legend>
<GhostRadioCard
v-for="option in rooms"
:key="option.id"
:value="option.id"
:disabled="option.soldOut"
>
{{ option.name }}
<template #description>
{{ option.soldOut ? 'Sold out for these dates' : option.detail }}
</template>
</GhostRadioCard>
</GhostRadioGroup>
</template>
<style scoped>
.room-grid {
display: grid;
gap: var(--ghost-space-gap-md);
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}
</style>Trace:
- Mount.
roomis'ocean'. The group renders the Ocean suite inputcheckedand that card's rootdata-state="checked"on the server and the client. The Loft card rendersdata-disabledand a disabled input. - Click the Family suite's price line. The click lands on the
descriptionspan inside the Family suite<label>. The label activates its input, which fireschange. The item calls the group'sselect, the group emitsupdate:modelValuewith'family', androombecomes'family'. Family suite's root gainsdata-state="checked"; Ocean suite's loses it. - Keyboard. Tab enters the group on the Family suite input; the card shows the focus ring.
ArrowUpmoves to Ocean suite and selects it.ArrowDownonce skips the disabled Loft and lands on Family suite. - Click the disabled Loft card. The label does not activate a disabled input. Nothing changes.
- Submit.
FormData.get('room')is'family'. - Reset. A native form reset restores the group's captured
defaultValueseed. The example setsdefault-value="ocean"next tov-model, so the group emits'ocean', Ocean suite is selected again and the card roots follow. Without adefaultValue, an uncontrolled group clears the selection, and a controlled group emits nothing and keeps the parent's value, as with plain items. - Forced colors. The selected card shows a doubled
Highlightborder and aHighlightdot. The focused card shows aHighlightoutline. The Loft card shows aGrayTextborder and text.
Several choices with GhostCheckboxGroup
The same booking form offers extras:
<script setup lang="ts">
import { ref } from 'vue'
import { GhostCheckboxCard, GhostCheckboxGroup } from '@ghostvue/themes'
type Extra = 'breakfast' | 'late-checkout' | 'parking'
const extras = ref<Extra[]>(['breakfast'])
</script>
<template>
<GhostCheckboxGroup v-model="extras" name="extras">
<legend>Extras</legend>
<GhostCheckboxCard value="breakfast">
Breakfast
<template #description>Served 7 to 10 AM · $18 a person</template>
</GhostCheckboxCard>
<GhostCheckboxCard value="late-checkout">
Late checkout
<template #description>Leave at 2 PM · $30</template>
</GhostCheckboxCard>
<GhostCheckboxCard value="parking">
Parking
<template #description>Covered garage · $25 a night</template>
</GhostCheckboxCard>
</GhostCheckboxGroup>
</template>Trace:
- Mount.
extrasis['breakfast']. The Breakfast card's root hasdata-state="checked"and its input is checked. - Click anywhere on Parking. The label activates the checkbox. The member calls the group's
setSelected('parking', true), the group emits['breakfast', 'parking'](append order, per the checkbox group spec), and the Parking card shows selected. - Keyboard. Each card is its own tab stop.
Spaceon Breakfast unchecks it; the group emits['parking']. - Submit.
FormData.getAll('extras')is the checked values in DOM order. - Controlled refusal. If the parent ignores an update, the group's member restore step resets the input on the next tick, and the card's
data-statefollows the unchanged model.
Test plan
- Vue component tests (
@ghostvue/vue).- Each card renders a
<label>root containing exactly one input of the right type, with the group'sname. - Clicking the root, the
labelspan and thedescriptionspan each activates the input (@testing-library/user-eventor dispatched clicks); clicking a disabled card does not. - Root
data-stateanddata-disabledfollow controlled, uncontrolled,defaultValue, groupdisabledand carddisabled, including a selected disabled card. - Controlled refusal: the root state follows the unchanged model after the input is restored.
aria-labelledbypoints at thelabelspan;aria-describedbyincludes the description id only when the slot exists and joins a consumer value.- A consumer
aria-labelledbyreplaces the generated one. indeterminateon a checkbox card is dropped: the input never shows mixed.- Attribute split:
class,styleanddata-visual-stateon the root;id,aria-*, otherdata-*and listeners on the input. A@changelistener fires once per activation on both cards, and on a plainGhostRadioGroupItemafter the listener fix. - Form submission and native reset through both groups with cards, and with cards and plain items mixed in one group.
- Exposed
element,inputElement,focusandblur. - Setup throws outside the matching group.
- Checkbox card keeps the
GHOST015,GHOST016andGHOST017warnings.
- Each card renders a
- Themed wrapper tests (
@ghostvue/themes). Wrappers forward props, slots, attributes and the exposed members. - Browser tests (Playwright).
- Room chooser example: click each region of a card, then press
Tab, arrow keys andSpace, and assert real focus,checked, the rootdata-stateand the submitted value. - Checkbox extras example: per-card tab stops and
Spacetoggling. - A group inside
<fieldset disabled>: cards show the disabled style and ignore clicks, with nodata-disabledon the root. - Cross-browser radio behavior inherits the existing
@cross-browserspecs; add one card case to the RTL arrow spec. - Forced colors (
page.emulateMedia({ forcedColors: 'active' })) screenshot assertions for selected, focused and disabled cards in light and dark. - Visual baselines for resting, hover, selected, focus-visible, disabled and invalid-group cards in light and dark.
- Room chooser example: click each region of a card, then press
- Accessibility tests. axe on both examples and the playground section; assert the computed accessible name equals the default slot text and the description is the accessible description.
- SSR and hydration. Server-render a selected card and a card with a description; hydrate without mismatch warnings; ids and
data-statematch. - Type tests. The exported components accept
valueanddisabled, reject a missingvalue, type thedescriptionslot, and type the exposed members. AGhostCheckboxGroup<Extra>with cards keeps theExtra[]model type.
Documentation plan
- A Choice cards section on the radio group page with the room chooser example (
examples/radio-group/room-chooser.vue). - A Choice cards section on the checkbox group page with the extras example (
examples/checkbox-group/room-extras.vue). - API tables for both cards, generated from their manifests (
pnpm docs:api:write). - Accessibility notes on both pages: phrasing-only slot content, no links or buttons inside a card, and the name and description wiring.
- A playground section showing both cards in every state, with unique copy.
Compatibility and release impact
- Additive minor Changesets for
@ghostvue/vueand@ghostvue/themes. - New manifests at
packages/vue/manifests/ghost-radio-card.manifest.json,packages/vue/manifests/ghost-checkbox-card.manifest.jsonand the matchingpackages/themes/manifests/files, withstatus: experimental. This spec'smanifestslist is filled in by the build. - No change to the existing parts' props, events, exposed members or markup. One listener fallthrough fix on
GhostRadioGroupItem: a consumeronChangeis chained after the item's own handler instead of being dropped. It belongs in the@ghostvue/vueChangeset as a fix. - The cards depend on the internal group contexts. Changes to those contexts must keep the cards' state mirror in step; the component tests above guard it.
Implementation gate
The build starts only after this spec merges on master with specStatus: approved and approval evidence. The build must add both cards, their themed wrappers and recipes, manifests, docs sections, examples, playground coverage, tests and Changesets together, and fill in this spec's manifests list in the same change.
Open architectural questions
None blocking. Recorded for later, not for v1:
- A hidden-indicator option, for designs that rely on the card border alone. It would need a non-color selected cue other than the indicator.
- A standalone
GhostCheckboxCardwith a boolean model outside a group. - A third content slot (for example media or a trailing price) if apps need a layout the label and description regions cannot express.