GhostRadioGroup reference
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed GhostRadioGroup and GhostRadioGroupItem with default radio ring styles.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
size | 'sm' | 'md' | 'lg' | "md" | No | Group layout density. The default omits data-size so CSS can treat a missing hook as md. |
Emits
None declared.
Models
None declared.
Slots
| Name | Description |
|---|---|
default | Container content. |
Slot props: default
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
element | HTMLElement | null | Root element after mount; null before mount. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Neutral content container. |
CSS variables
| Name | Description |
|---|---|
--ghost-surface-fg | Inherited text color. |
Accessibility
Role: generic. APG pattern: https://www.w3.org/WAI/ARIA/apg/.
Required ARIA attributes: none.
Keyboard
None declared.
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
radio-group/deployment-tier
Vertical tier cards and compact horizontal billing cadence with GhostRadioGroup.
<script setup lang="ts">
import { computed, ref } from 'vue'
import {
GhostButton,
GhostCard,
GhostRadioGroup,
GhostRadioGroupItem,
} from '@ghostvue/themes'
interface Tier {
value: string
label: string
price: string
description: string
disabled?: boolean
}
const tiers: readonly Tier[] = [
{
value: 'starter',
label: 'Starter',
price: '$0 / mo',
description: 'Shared compute, 100 GB bandwidth, community support.',
},
{
value: 'pro',
label: 'Pro',
price: '$29 / mo',
description:
'Dedicated workers, automatic rollbacks, and 99.95% uptime SLA.',
},
{
value: 'enterprise',
label: 'Enterprise',
price: 'Custom',
description:
'Single-tenant VPC peering. Contact sales to unlock for this workspace.',
disabled: true,
},
]
const selectedTier = ref('pro')
const cadence = ref('annual')
const saved = ref(false)
const summaryText = computed(() => {
const tier = tiers.find((entry) => entry.value === selectedTier.value)
return `${tier?.label ?? 'Pro'} (${cadence.value})`
})
function save(): void {
saved.value = true
}
function clearSaved(): void {
saved.value = false
}
</script>
<template>
<form class="tier-form" @submit.prevent="save" @change="clearSaved">
<GhostCard as="section" aria-labelledby="tier-title">
<template #header>
<div class="tier-form__header">
<h2 id="tier-title" class="tier-form__title">Deployment tier</h2>
<p class="tier-form__lead">
Choose compute capacity and billing cadence for this project.
</p>
</div>
</template>
<div class="tier-form__groups">
<fieldset class="tier-form__fieldset">
<legend class="tier-form__legend">Compute plan</legend>
<GhostRadioGroup
v-model="selectedTier"
name="tier"
orientation="vertical"
>
<div v-for="tier in tiers" :key="tier.value" class="tier-option">
<GhostRadioGroupItem
:id="`tier-${tier.value}`"
:value="tier.value"
:disabled="Boolean(tier.disabled)"
:aria-describedby="`tier-${tier.value}-desc`"
/>
<label :for="`tier-${tier.value}`" class="tier-option__label">
<span>{{ tier.label }}</span>
<span class="tier-option__price">{{ tier.price }}</span>
</label>
<p :id="`tier-${tier.value}-desc`" class="tier-option__desc">
{{ tier.description }}
</p>
</div>
</GhostRadioGroup>
</fieldset>
<fieldset class="tier-form__fieldset">
<legend class="tier-form__legend">Billing cadence</legend>
<GhostRadioGroup
v-model="cadence"
name="cadence"
orientation="horizontal"
size="sm"
>
<label class="cadence-option">
<GhostRadioGroupItem value="monthly" />
<span>Monthly</span>
</label>
<label class="cadence-option">
<GhostRadioGroupItem value="annual" />
<span>Annual (save 20%)</span>
</label>
</GhostRadioGroup>
</fieldset>
</div>
<template #footer>
<div class="tier-form__actions">
<p class="tier-form__status" role="status">
{{ saved ? `Saved ${summaryText}.` : `Selected: ${summaryText}` }}
</p>
<GhostButton type="submit" class="tier-form__action">
Update plan
</GhostButton>
</div>
</template>
</GhostCard>
</form>
</template>
<style scoped>
.tier-form {
max-inline-size: 36rem;
}
.tier-form__header {
display: grid;
gap: var(--ghost-space-gap-xs);
padding-block-end: var(--ghost-space-stack-sm);
}
.tier-form__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.tier-form__lead,
.tier-form__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.tier-form__groups {
display: grid;
gap: var(--ghost-space-stack-lg);
}
.tier-form__fieldset {
border: none;
display: grid;
gap: var(--ghost-space-stack-sm);
margin: 0;
min-inline-size: 0;
padding: 0;
}
.tier-form__legend {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-snug);
padding: 0;
}
.tier-option {
column-gap: var(--ghost-space-gap-sm);
display: grid;
grid-template-columns: auto minmax(0, 1fr);
row-gap: var(--ghost-space-gap-xs);
}
.tier-option :deep(.ghost-radio-group-item) {
grid-row: 1 / span 2;
}
.tier-option__label {
align-items: baseline;
color: var(--ghost-text-default);
cursor: pointer;
display: flex;
flex-wrap: wrap;
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
gap: var(--ghost-space-gap-sm);
grid-column: 2;
justify-content: space-between;
line-height: var(--ghost-type-line-snug);
padding-block-start: calc((var(--ghost-control-size-md-min) - 1lh) / 2);
}
.tier-option__price {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-weight: var(--ghost-type-weight-regular);
}
.tier-option__desc {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
grid-column: 2;
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.cadence-option {
align-items: center;
color: var(--ghost-text-default);
cursor: pointer;
display: inline-flex;
font-size: var(--ghost-type-size-sm);
gap: var(--ghost-space-gap-xs);
line-height: var(--ghost-type-line-snug);
}
.tier-form__actions {
display: grid;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
}
.tier-form :deep(.tier-form__action) {
inline-size: 100%;
}
@container ghost-demo (min-width: 30rem) {
.tier-form__actions {
align-items: center;
display: flex;
justify-content: flex-end;
}
.tier-form__status {
flex: 1 1 auto;
}
.tier-form :deep(.tier-form__action) {
inline-size: auto;
}
}
</style>
radio-group/room-chooser
Whole-card room choices with GhostRadioCard: a selected default, a sold-out card, and the submitted value.
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, 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')
const submitted = ref<string | null>(null)
const selectedName = computed(
() => rooms.find((option) => option.id === room.value)?.name ?? 'none',
)
function book(event: SubmitEvent): void {
if (!(event.currentTarget instanceof HTMLFormElement)) return
const value = new FormData(event.currentTarget).get('room')
submitted.value = typeof value === 'string' ? value : null
}
function clearSubmitted(): void {
submitted.value = null
}
</script>
<template>
<form
class="booking"
@submit.prevent="book"
@change="clearSubmitted"
@reset="clearSubmitted"
>
<!--
Each card is a native <label> around its radio, so a click on the name,
the detail line, or the padding selects the room. Keep card content to
text: no links or buttons inside a card.
-->
<GhostRadioGroup
v-model="room"
default-value="ocean"
name="room"
class="booking__rooms"
>
<legend class="booking__legend">Room</legend>
<GhostRadioCard
v-for="option in rooms"
:key="option.id"
:value="option.id"
:disabled="Boolean(option.soldOut)"
>
{{ option.name }}
<template #description>
{{ option.soldOut ? 'Sold out for these dates' : option.detail }}
</template>
</GhostRadioCard>
</GhostRadioGroup>
<div class="booking__actions">
<p class="booking__status" role="status">
{{
submitted
? `Submitted room=${submitted}`
: `Selected: ${selectedName}`
}}
</p>
<GhostButton type="reset" variant="ghost">Reset</GhostButton>
<GhostButton type="submit">Book room</GhostButton>
</div>
</form>
</template>
<style scoped>
.booking {
display: grid;
gap: var(--ghost-space-stack-md);
max-inline-size: 40rem;
}
/* The themed group puts `class` on its inner fieldset, so reach it with :deep(). */
.booking :deep(.booking__rooms) {
display: grid;
gap: var(--ghost-space-gap-md);
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}
.booking__legend {
font-weight: var(--ghost-type-weight-semibold);
margin-block-end: var(--ghost-space-stack-sm);
padding: 0;
}
.booking__actions {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
}
.booking__status {
color: var(--ghost-text-muted);
flex: 1 1 12rem;
margin: 0;
}
</style>
radio-group/themed
Styled radio dots from @ghostvue/themes.
<script setup lang="ts">
import { ref } from 'vue'
import { GhostRadioGroup, GhostRadioGroupItem } from '@ghostvue/themes'
const density = ref('comfortable')
</script>
<template>
<div class="ghost-theme">
<GhostRadioGroup v-model="density" name="density" orientation="horizontal">
<label>
<GhostRadioGroupItem value="compact" />
Compact
</label>
<label>
<GhostRadioGroupItem value="comfortable" />
Comfortable
</label>
<label>
<GhostRadioGroupItem value="spacious" />
Spacious
</label>
</GhostRadioGroup>
</div>
</template>
<style scoped>
label {
align-items: center;
display: inline-flex;
gap: 0.5rem;
margin-inline-end: 1rem;
}
</style>
radio-group/scoped-styles
RadioGroup, Toolbar, Link, and Card side by side in a scoped layout, each with the scoped selector that reaches it.
.billing__plans.billing__actions.billing__help Compare plans .billing__summary<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostCard,
GhostLink,
GhostRadioGroup,
GhostRadioGroupItem,
GhostToolbar,
} from '@ghostvue/themes'
const plan = ref('team')
</script>
<template>
<div class="billing">
<div class="billing__cell">
<code class="billing__selector">.billing__plans</code>
<GhostRadioGroup
v-model="plan"
class="billing__plans"
name="plan"
orientation="horizontal"
aria-label="Plan"
>
<label class="billing__option">
<GhostRadioGroupItem value="starter" />
Starter
</label>
<label class="billing__option">
<GhostRadioGroupItem value="team" />
Team
</label>
</GhostRadioGroup>
</div>
<div class="billing__cell">
<code class="billing__selector">.billing__actions</code>
<GhostToolbar class="billing__actions" label="Plan actions">
<GhostButton size="sm" variant="outline">Cancel</GhostButton>
<GhostButton size="sm">Save plan</GhostButton>
</GhostToolbar>
</div>
<div class="billing__cell">
<code class="billing__selector">.billing__help</code>
<GhostLink class="billing__help" href="#compare-plans">
Compare plans
</GhostLink>
</div>
<div class="billing__cell">
<code class="billing__selector">.billing__summary</code>
<GhostCard class="billing__summary">
{{ plan === 'team' ? 'Team' : 'Starter' }} plan, billed monthly
</GhostCard>
</div>
</div>
</template>
<style scoped>
.billing {
display: grid;
gap: var(--ghost-space-gap-lg);
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.billing__cell {
align-content: start;
display: grid;
gap: var(--ghost-space-gap-sm);
}
.billing__selector {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
}
.billing__option {
align-items: center;
display: inline-flex;
gap: var(--ghost-space-gap-xs);
}
/*
* GhostRadioGroup, GhostToolbar and GhostLink wrap their root in a
* `display: contents` span. They copy this block's scope attribute from the
* span to the inner element that receives `class`, so a plain scoped
* selector matches it.
*/
.billing__plans {
gap: var(--ghost-space-gap-lg);
}
.billing__actions {
justify-content: flex-end;
}
.billing__help {
font-weight: var(--ghost-type-weight-semibold);
justify-self: start;
}
/* GhostCard has no wrapper: `class` and the scope attribute share its root. */
.billing__summary {
border-inline-start: 0.25rem solid var(--ghost-border-primary);
}
</style>