Skip to content

Radio

Select a single option among a group of choices.

Basic Usage

A radio group consists of multiple yh-radio components wrapped in a yh-radio-group. Bind v-model to enable single-choice functionality.

Selected Value: 1

Basic Usage

Disabled State

Use the disabled property to control the disabled state of the radio.

Disable entire group:

Disable individual:

Disabled State

Individual usage

Radio can also be used alone without being wrapped by RadioGroup.

Selected Value: 1

Individual usage

With Border

Use the border property to render the radio with a border.

With Border

Different Sizes

Use the size property to set the size of the radio.

Different Sizes

Uniform Group Size

Set the size property on the yh-radio-group to uniformly control the size of all radios in the group.

Large:

Default:

Small:

Uniform Group Size

Button Style

Use the yh-radio-button component to implement button-style radios.

Button Style

Button Style Custom Color

Customize the fill and text colors of the checked button using the fill and text-color properties.

Button Style Custom Color

Button Style Disabled

Button Style Disabled

Button Style Different Sizes

Large:

Default:

Small:

Button Style Different Sizes

Use in Nuxt

The Radio component fully supports Nuxt 3/4 SSR rendering. When used in a Nuxt project, the component is automatically imported.

Use in Nuxt

SSR Notes:

  • ✅ Basic radio, button style, and radio group are fully supported.
  • ✅ Styles and checked states render accurately in the SSR environment.
  • ✅ Custom colors (fill, text-color) are supported.

SSR Safety

The Radio component has passed complete SSR testing to ensure that the server-side preselected state remains consistent with the client-side state after hydration.

API

Radio Props

PropDescriptionTypeDefault
model-value / v-modelBinding valuestring | number | boolean
valueValue of radiostring | number | boolean
labelText content to displaystring
disabledWhether to disablebooleanfalse
borderWhether to show borderbooleanfalse
sizeRadio size'large' | 'default' | 'small''default'
nameNative name attributestring

Radio Events

Event NameDescriptionCallback Parameters
changeTriggered when the binding value changes(value: string | number | boolean) => void

Radio Slots

Slot NameDescription
defaultCustom default content

RadioButton Props

PropDescriptionTypeDefault
model-value / v-modelBinding valuestring | number | boolean
valueValue of radio buttonstring | number | boolean
labelText content to displaystring
disabledWhether to disablebooleanfalse
sizeRadio button size'large' | 'default' | 'small''default'
nameNative name attributestring

RadioButton Events

Event NameDescriptionCallback Parameters
changeTriggered when the binding value changes(value: string | number | boolean) => void

RadioButton Slots

Slot NameDescription
defaultCustom default content

RadioGroup Props

PropDescriptionTypeDefault
model-value / v-modelBinding valuestring | number | boolean
sizeRadio group size'large' | 'default' | 'small'
disabledWhether to disablebooleanfalse
nameNative name attributestring
text-colorText color when button is activestring#fff
fillFill color and border color when button is activestringvar(--yh-color-primary)

RadioGroup Events

Event NameDescriptionCallback Parameters
changeTriggered when the binding value changes(value: string | number | boolean) => void

RadioGroup Slots

Slot NameDescription
defaultCustom default content

Theme Variables

Radio Theme Variables

VariableDescriptionDefault
--yh-radio-font-sizeFont sizevar(--yh-font-size-base)
--yh-radio-text-colorText colorvar(--yh-text-color-regular)
--yh-radio-input-sizeRadio size14px
--yh-radio-checked-dot-colorChecked dot colorvar(--yh-color-primary)
--yh-radio-disabled-bg-colorDisabled background colorvar(--yh-fill-color-light)

RadioButton Theme Variables

VariableDescriptionDefault
--yh-radio-button-font-sizeFont sizevar(--yh-font-size-base)
--yh-radio-button-text-colorText colorvar(--yh-text-color-regular)
--yh-radio-button-checked-bg-colorChecked background colorvar(--yh-color-primary)
--yh-radio-button-checked-text-colorChecked text colorvar(--yh-fill-color-blank)
--yh-radio-button-disabled-bg-colorDisabled background colorvar(--yh-fill-color-light)

Released under the MIT License.