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.
Vertical tier cards and compact horizontal billing cadence with GhostRadioGroup.
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
Whole-card room choices with GhostRadioCard: a selected default, a sold-out card, and the submitted value.
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
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.
Headless radio group with labeled items.
Headless field and form recipes
Group label, description, and error through GhostField.
Native submit and reset with a shared name.
API
GhostRadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
as | GhostRadioGroupElement | "fieldset" | Root host. Non-fieldset hosts use role="radiogroup". |
defaultValue | string | — | Initial value when uncontrolled; omitted means none checked. Form reset restores this seed. |
disabled | boolean | false | Disables the group. |
invalid | boolean | false | Sets aria-invalid on the root for Field. |
modelValue | string | — | Controlled selected value. Omit for uncontrolled use. |
name | string | — | Shared native name; generated when omitted. |
orientation | GhostRadioGroupOrientation | "vertical" | Themed layout (data-orientation); not keyboard behavior. |
required | boolean | false | Native required on item inputs. |
| Slot | Slot props | Description |
|---|---|---|
default | — | Container content. |
@ghostvue/themes adds these to the headless GhostRadioGroup API, which it forwards:
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | "md" | Group layout density. The default omits data-size so CSS can treat a missing hook as md. |
GhostRadioGroupItem
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables this option only. |
value | string | Required | Option value; must be unique in the group. |
GhostRadioCard
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables this card. The card is also disabled when the group is. |
value | string | Required | Option value, passed to the inner radio. Stable, unique in the group, and the submitted value. |
| Slot | Slot props | Description |
|---|---|---|
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). Uselegendor associate a group label witharia-labelledbywhen 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 ancestordir.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 thedescriptionslot is the accessible description. A consumeraria-labelledbyreplaces the generated one; a consumeraria-describedbyis added after the description. Name a card with its default slot, notaria-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.