Skip to content

GkRadioGroup & GkRadio

GkRadioGroup provides a shared name and v-model for GkRadio children, with optional group disabled / readonly (aligned with GkCheckbox / GkInput patterns). Use ariaLabel on the group when there is no visible group heading.

When to use

Use radios when users must choose exactly one option from a small, mutually exclusive set.

Live Examples

Basic

GkRadioGroup owns v-model; children declare value.

Best practice: Give the group an aria-label or visible heading for context.

Disabled group

Pass disabled on the group to lock every option.

Readonly review

Readonly prevents changing the selection while preserving announced values.

API

GkRadioGroup props

PropTypeDefaultDescription
modelValuestring | number | undefinedSelected value (v-model)
namestringOptional; defaults to a stable generated name
ariaLabelstringAccessible name for the radiogroup
disabledbooleanfalseDisables all radios (each radio can still set disabled)
readonlybooleanfalsePrevents changing the selection; aria-readonly on the group

Root class applies to the group container; other attributes are forwarded to the radiogroup wrapper.

GkRadio props

PropTypeDefaultDescription
valuestring | numberrequiredValue when this option is selected
disabledbooleanfalseDisables this option (combined with group disabled)
size'xs' | 'sm' | 'md' | 'lg' | 'xl'Scales the radio and label typography; omit for global defaults

Events (GkRadioGroup)

EventPayloadDescription
update:modelValuestring | number | undefinedNew selection

Events (GkRadio)

EventPayloadDescription
update:focusedbooleanFocus on the native radio

Expose (GkRadio)

NameTypeDescription
inputHTMLInputElementNative radio

GK_RADIO_GROUP

Injected context includes isDisabled and isReadonly for the group. See Composables and GkRadioGroupContext in the package types.

Examples

Each scenario under Live Examples includes a copyable Vue snippet.

Accessibility notes

  • Provide a group-level label (ariaLabel or visible heading) so assistive tech can announce context.
  • Use radios only when one and only one option can be selected.

Released under the MIT License.