Skip to content

Radio Group

Choose exactly one option while moving through a labeled set.

Usage

Vertical

Use vertical movement while preserving the same pane-size rules.

Arrow keys move and check like a native radio group. Form values use hidden native radios.

Horizontal disabled

Move horizontally through radio choices while skipping an unavailable option.

Arrow keys move and check like a native radio group. Form values use hidden native radios.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Arrow keys move and check like a native radio group. Form values use hidden native radios.

API

Vue package: @sectile/vue/radio-group

Components
  • RadioGroupRoot
  • RadioGroupItem
  • RadioGroupIndicator

Props

RadioGroupRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

disabledItems

Item values excluded from focus and selection.

form

ID of the native form associated with the control.

items

Ordered item values managed by the component.

modelValue

Current value when state is controlled by the parent.

name

Name used for native form submission.

orientation

Axis used for layout and keyboard movement.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

RadioGroupItemProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

disabled

Whether interaction is unavailable.

value

Current value exposed by this contract.

RadioGroupIndicatorProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

RadioGroupRootSlotProps

disabled

Whether interaction is unavailable.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

RadioGroupItemSlotProps

checked

Whether the control is checked.

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

value

Current value exposed by this contract.

Events

RadioGroupRoot

highlight

Emitted when the highlighted item changes.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

RadioGroupValueChangeHandler

ts
type RadioGroupValueChangeHandler = (value: string) => void

RadioGroupHighlightHandler

ts
type RadioGroupHighlightHandler = (value: string | null) => void

Parts

Shared scope: [data-scope="radio-group"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
item[data-part="item"]Represents one selectable or actionable item.
indicator[data-part="indicator"]Shows state or position without replacing the primary content.

Keyboard interaction

KeyBehavior
Arrow keysMove the active option in the visible orientation.
Home / EndMove to the first or last eligible option.
Enter / SpaceSelect or activate the current option.
Printable textMove to the next matching option when typeahead is available.

Accessibility

The group and each radio expose checked, highlighted, and disabled state with one roving tab stop.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.