Skip to content

GhostRadioGroup ​

GhostRadioGroup is a native radio group with GhostRadioGroupItem parts. Keyboard and tab order use the platform same-name radio model (arrow keys move focus and select). Import from @ghostvue/vue for headless use, or from @ghostvue/themes for the default visual treatment.

Deployment tier

Vertical tier cards and compact horizontal billing cadence with GhostRadioGroup.

Deployment tier

Choose compute capacity and billing cadence for this project.

Compute plan

Shared compute, 100 GB bandwidth, community support.

Dedicated workers, automatic rollbacks, and 99.95% uptime SLA.

Single-tenant VPC peering. Contact sales to unlock for this workspace.

Billing cadence

Selected: Pro (annual)

The deployment selector pairs a vertical GhostRadioGroup for compute tiers (including a disabled enterprise option) with a compact size="sm" horizontal group for billing cadence.

Focus Pro and press Down Arrow to move focus and selection to Starter, skipping the disabled Enterprise option. Choose a billing cadence and select Update plan to see both selected values.

Basic use ​

Wrap each item in a <label> or associate labels with for/id. A shared name enables native form submission. When name is omitted, the group still generates a stable shared name so items behave as one native group; pass an explicit name for forms you intend to submit.

Field integration ​

Spread GhostFieldControl slot props onto the group root. Per-option labels stay local to each item input. See the Field guide for how the label and description are associated.

Forms and reset ​

defaultValue is the form-reset seed. A native reset on the owner form restores that mounted value. Try the native reset in the headless form recipe.

Choice cards ​

Room chooser

Whole-card room choices with GhostRadioCard: a selected default, a sold-out card, and the submitted value.

Room

Selected: Ocean suite

GhostRadioCard is a card-shaped member of GhostRadioGroup. Its root is a native <label> around a GhostRadioGroupItem, so a click anywhere on the card (the name, the detail line, or the padding) selects it, with no script. The group keeps its model, form submission, reset, and arrow-key behavior, because the input inside the card is the same item the group already manages. Cards and plain items can share one group.

The default slot is the option's name and the description slot is its detail. The card root carries data-state="checked" while selected and data-disabled when the card or the group is disabled, so its own styles need no :has(). The themed card draws a doubled primary border and a light tint when selected, one focus ring on the card, and keeps the radio dot as the cue that does not rely on color. In forced colors, the selected card keeps the thicker Highlight border.

Arrange cards with CSS on the group root, as the example does with a grid. class, style, and data-visual-state stay on the card root; every other attribute and listener, such as id, aria-*, data-*, or @change, goes to the inner radio.

Themed use ​

Themed

Styled radio dots from @ghostvue/themes.

The themed wrapper adds size on the group (layout density). Item radios pick up the default ring and dot styles.

Customize with headless radio groups ​

Use the headless parts from @ghostvue/vue when you supply the radio styles.

Basic Headless

Headless radio group with labeled items.

Selected plan: starter

Headless field and form recipes ​

Field wiring Headless

Group label, description, and error through GhostField.

Choose a channel before saving.
Form reset Headless

Native submit and reset with a shared name.

Deploy region

API ​

GhostRadioGroup ​

PropTypeDefaultDescription
asGhostRadioGroupElement"fieldset"Root host. Non-fieldset hosts use role="radiogroup".
defaultValuestring—Initial value when uncontrolled; omitted means none checked. Form reset restores this seed.
disabledbooleanfalseDisables the group.
invalidbooleanfalseSets aria-invalid on the root for Field.
modelValuestring—Controlled selected value. Omit for uncontrolled use.
namestring—Shared native name; generated when omitted.
orientationGhostRadioGroupOrientation"vertical"Themed layout (data-orientation); not keyboard behavior.
requiredbooleanfalseNative required on item inputs.
SlotSlot propsDescription
default—Container content.

@ghostvue/themes adds these to the headless GhostRadioGroup API, which it forwards:

PropTypeDefaultDescription
size'sm' | 'md' | 'lg'"md"Group layout density. The default omits data-size so CSS can treat a missing hook as md.

GhostRadioGroupItem ​

PropTypeDefaultDescription
disabledbooleanfalseDisables this option only.
valuestringRequiredOption value; must be unique in the group.

GhostRadioCard ​

PropTypeDefaultDescription
disabledbooleanfalseDisables this card. The card is also disabled when the group is.
valuestringRequiredOption value, passed to the inner radio. Stable, unique in the group, and the submitted value.
SlotSlot propsDescription
default—The option's accessible name. Phrasing content only.
description—Supporting detail, announced as the description. Phrasing content only.

@ghostvue/themes adds no props, events, or slots to the headless GhostRadioCard API, which it forwards.

Accessibility ​

  • Default root: fieldset (native group). Use legend or associate a group label with aria-labelledby when not using Field.

  • Native group: one tab stop; arrow keys move focus and select among items with a shared name. RTL follows the root or ancestor dir.

  • Choice cards keep the native radio as the focus target, so keyboard behavior is unchanged. The card's name is only its default slot text, through aria-labelledby, and the description slot is the accessible description. A consumer aria-labelledby replaces the generated one; a consumer aria-describedby is added after the description. Name a card with its default slot, not aria-label.

  • Card content must be phrasing content (text, strong, em, img, badges), because the card is a <label>. Do not put links, buttons, or other controls inside a card; put actions such as "View photos" next to the group.

See the specification and the choice cards specification for the full contracts.