Skip to content

Radio Component ​

Radio Component

Radio component is used to select one option from multiple alternatives. Users can change the selected state by clicking.

Basic Usage ​

Basic radio for selecting a single state.

Current value: false
Current value: Option 1
Show CodeArrow
CopyGitHub

Disabled State ​

Set the disabled attribute to disable the radio.

Show CodeArrow
CopyGitHub

Different Styles ​

Set the radius attribute to change the radio style, supporting default (circular) and square (square).

Round Style (Default):
Square Style:
Show CodeArrow
CopyGitHub

Custom Icon ​

Set the icon attribute to customize the radio icon.

Show CodeArrow
CopyGitHub

Radio Group ​

Use the t-radio-group component to combine multiple radios into a group, bind values through v-model.

Current value: 1
Show CodeArrow
CopyGitHub

Radio Group Types ​

Radio group supports four types: default (default), text (text), border (border), and button (button).

Default Type:
Text Type:
Border Type:
Button Type:
Show CodeArrow
CopyGitHub

Arrangement Direction ​

Set the arrangement direction of radio group through the direction attribute, supporting row (horizontal) and column (vertical).

Horizontal Layout (row):
Vertical Layout (column):
Show CodeArrow
CopyGitHub

Event Handling ​

Radio and radio group provide change events.

Radio Events:

Radio Group Events:

Event Log:

Show CodeArrow
CopyGitHub

Radio API ​

Attributes ​

AttributeDescriptionTypeAccepted ValuesDefault
v-modelBinding valuestring / number / boolean / object——
valueValue when selectedstring / number / boolean / object—false
sizeSizestringsmall / default / largedefault
radiusSelected shape stylestringdefault / squaredefault
objKeyBinding object type mark keystring——
disabledWhether disabledboolean—false
nameNative name attributestring——
iconCustom icon typestring——

Events ​

Event NameDescriptionParameters
changeTriggered when value changes(value: string / number / boolean / object)

Slots ​

Slot NameDescription
defaultRadio text content
radioSpanCustom radio icon

Radio Group API ​

Attributes ​

AttributeDescriptionTypeAccepted ValuesDefault
v-modelBinding valuestring / number / boolean / object——
sizeSizestringsmall / default / largedefault
objKeyBinding object mark keystring——
typeRadio group typestringdefault / text / border / buttonbutton
directionArrangement directionstringcolumn / rowrow
immediateChangeWhether immediately trigger change eventboolean—false

Events ​

Event NameDescriptionParameters
changeTriggered when value changes(value: string / number / boolean / object)

Style Variables ​

The radio component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$theme-color-primaryTheme color - Primary
$border-color-defaultBorder color - Default
$font-size-smallFont size - Small
$font-size-defaultFont size - Default
$font-size-largeFont size - Large

Released under the MIT License