MigsLab UIVue 3 component workshop

Form

Radio

Pick exactly one option. Use RadioGroupComponent for a list of options, or RadioButtonComponent for custom layouts.

import { RadioGroupComponent, RadioButtonComponent } from '@/MigsLab/shared'

Radio group

Selected: md
<RadioGroupComponent v-model="size" :options="sizeOptions" />
<RadioGroupComponent v-model="size" :options="sizeOptions" direction="horizontal" />

Individual radio buttons

<RadioButtonComponent v-model="plan" value="free" name="plan">Free</RadioButtonComponent>
<RadioButtonComponent v-model="plan" value="pro" name="plan">Pro</RadioButtonComponent>

API

RadioGroupComponent props

NameType Default Description
v-modelstring | numberundefinedSelected value.
optionsSelectOption[]—Options as { label, value, disabled? }.
direction'vertical' | 'horizontal''vertical'Stack or line up the options.
namestringauto idNative name shared by the radios.
disabledbooleanfalseDisable every option.

RadioButtonComponent props

NameType Default Description
v-modelstring | numberundefinedSelected value shared by the group.
valuestring | number—Value this radio represents.
namestringundefinedNative name; give related radios the same name.
disabledbooleanfalseDisable this radio.