Formulários
VRadioGroup
Seleção única entre opções mutuamente exclusivas, com layouts vertical, horizontal e card.
<script setup lang="ts">
import { VRadioGroup } from 'vueui-nova-kit'
</script>Uso
<script setup lang="ts">
</script>
<template>
</template>Playground
Os controles abaixo são gerados a partir das props declaradas em VRadioGroup.types.ts; o código acompanha cada mudança.
Exemplos
Variantes, tamanhos e estados, extraídos das stories da biblioteca.
Default
Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo. Props: modelValue="email", label="Notification method".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('email')
const options = [
{
value: 'email',
label: 'Email notifications',
description: 'Get notified via email',
},
{
value: 'push',
label: 'Push notifications',
description: 'Get notified on your device',
},
{
value: 'sms',
label: 'SMS notifications',
description: 'Get text message alerts',
},
]
</script>
<template>
<VRadioGroup
v-model="value"
:options="options"
label="Notification method" />
</template>Vertical
Variação Vertical. Props: modelValue="email", label="Choose a notification chann…", layout="vertical".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('email')
const options = [
{
value: 'email',
label: 'Email notifications',
description: 'Get notified via email',
},
{
value: 'push',
label: 'Push notifications',
description: 'Get notified on your device',
},
{
value: 'sms',
label: 'SMS notifications',
description: 'Get text message alerts',
},
]
</script>
<template>
<VRadioGroup
v-model="value"
:options="options"
label="Choose a notification channel" />
</template>Horizontal
Variação Horizontal. Props: modelValue="monthly", label="Billing cycle", layout="horizontal".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('monthly')
const options = [
{ value: 'monthly', label: 'Monthly' },
{ value: 'yearly', label: 'Yearly' },
{ value: 'lifetime', label: 'Lifetime' },
]
</script>
<template>
<VRadioGroup
v-model="value"
layout="horizontal"
:options="options"
label="Billing cycle" />
</template>Card
Variação Card. Props: modelValue="free", label="Choose a plan", layout="card".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('free')
const options = [
{
value: 'free',
label: 'Free',
description: 'For getting started',
},
{
value: 'pro',
label: 'Pro',
description: 'More features',
},
{
value: 'business',
label: 'Business',
description: 'Advanced controls',
},
]
</script>
<template>
<VRadioGroup
v-model="value"
layout="card"
:options="options"
label="Choose a plan" />
</template>Plans
Variação Plans. Props: modelValue="personal", label="Choose a plan".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('personal')
const options = [
{
value: 'personal',
label: 'Personal plan',
description: 'For individuals',
},
{
value: 'team',
label: 'Team plan',
description: 'For small teams',
},
{
value: 'enterprise',
label: 'Enterprise',
description: 'For large organizations',
},
]
</script>
<template>
<VRadioGroup v-model="value" :options="options" label="Choose a plan" />
</template>Error
Variação Erro. Props: modelValue="", label="Choose a plan", required=true, errorMessage="Please select a plan to con…".
Ver código
<script setup lang="ts">
import { VRadioGroup } from 'vueui-nova-kit'
const options = [
{
value: 'personal',
label: 'Personal plan',
description: 'For individuals',
},
{
value: 'team',
label: 'Team plan',
description: 'For small teams',
},
{
value: 'enterprise',
label: 'Enterprise',
description: 'For large organizations',
},
]
</script>
<template>
<VRadioGroup
v-model="value"
:options="options"
label="Choose a plan"
required
error-message="Please select a plan to continue." />
</template>Disabled
Variação Desabilitado. Props: modelValue="team", label="Choose a plan", disabled=false.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('team')
const options = [
{
value: 'personal',
label: 'Personal plan',
description: 'For individuals',
disabled: false,
},
{
value: 'team',
label: 'Team plan',
description: 'For small teams',
disabled: true,
},
{
value: 'enterprise',
label: 'Enterprise',
description: 'For large organizations',
disabled: false,
},
]
</script>
<template>
<VRadioGroup v-model="value" :options="options" label="Choose a plan" />
</template>Group Disabled
Variação Grupo desabilitado. Props: modelValue="email", label="Notification method", disabled=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const value = ref('email')
const options = [
{
value: 'email',
label: 'Email notifications',
description: 'Get notified via email',
},
{
value: 'push',
label: 'Push notifications',
description: 'Get notified on your device',
},
{
value: 'sms',
label: 'SMS notifications',
description: 'Get text message alerts',
},
]
</script>
<template>
<VRadioGroup
v-model="value"
:options="options"
label="Notification method"
disabled />
</template>Sizes
Variação Tamanhos. Interativo: o estado é mantido na própria story (v-model).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VRadioGroup } from 'vueui-nova-kit'
const sm = ref('email')
const md = ref('email')
const lg = ref('email')
const notificationOptions = [
{
value: 'email',
label: 'Email notifications',
description: 'Get notified via email'
},
{
value: 'push',
label: 'Push notifications',
description: 'Get notified on your device'
},
{
value: 'sms',
label: 'SMS notifications',
description: 'Get text message alerts'
}
]
</script>
<template>
<div style="display:flex;flex-direction:column;gap:20px;max-width:480px">
<VRadioGroup v-model="sm" size="sm" label="Small" :options="notificationOptions" />
<VRadioGroup v-model="md" size="md" label="Medium" :options="notificationOptions" />
<VRadioGroup v-model="lg" size="lg" label="Large" :options="notificationOptions" />
</div>
</template>Acessibilidade
fieldset + legend, inputs nativos type="radio", Tab e arrow keys, foco visível, área mínima 44×44px, aria-invalid no erro.
Estados
Unselected · Hover · Focus · Selected · Pressed · Disabled · Disabled Selected · Error.
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Hover | border-color | 100ms | ease-out |
| Select | dot scale/opacity | 140ms | standard |
| Focus ring | box-shadow | 120ms | ease-out |
| Pressed | transform scale | 70ms | ease-in |
| Card select | background/border | 140ms | ease-out |
Respeitar prefers-reduced-motion.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
modelValue | string | "" | — |
options* | VRadioOption[] | [] | — |
label | string | — | — |
description | string | — | — |
errorMessage | string | — | — |
disabled | boolean | false | — |
size | VRadioGroupSize | "md" | — |
layout | VRadioGroupLayout | "vertical" | — |
name | string | — | — |
id | string | — | — |
required | boolean | false | — |
motion | VMotionLevel | V_MOTION_DEFAULT ("expressive") | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: string | — |
@change | value: string | — |
Slots
Sem slots.
Fonte: src/components/form/VRadioGroup/VRadioGroup.vue · tipos: src/components/form/VRadioGroup/VRadioGroup.types.ts