RadioGroup

RadioGroup wraps multiple Radio components. It accepts the v-model and name attributes and passes them to each internal Radio. This results in much cleaner markup, because only the value prop is needed on each Radio component.

option-1
Code Example
<script setup lang="ts">
const value = ref('neutral')
const options = [
  { label: 'Neutral', color: 'neutral' },
  { label: 'Primary', color: 'primary' },
  { label: 'Secondary', color: 'secondary' },
  { label: 'Accent', color: 'accent' },
]
</script>

<template>
  <Card bordered class="w-64 p-6">
    <RadioGroup v-model="value" name="group">
      <Label class="cursor-pointer">
        <LabelText>Option 1</LabelText>
        <Radio value="option-1" />
      </Label>

      <Label class="cursor-pointer">
        <LabelText>Option 2</LabelText>
        <Radio value="option-2" />
      </Label>

      <Label class="cursor-pointer">
        <LabelText>Option 3</LabelText>
        <Radio value="option-3" />
      </Label>
    </RadioGroup>
  </Card>
</template>

Components

RadioGroup wraps and passes props to all Radio children. Props passed directly to Radio components will override the ones inherited from RadioGroup.

RadioGroup

RadioGroup can be customized with the following props:

PropTypeDescription
model-value
string
Controls the selected state. Use with v-model
value
string
Sets the value. required
disabled
string
disables the component
color
string
Sets the color to one of the below prop names.
   
neutral
boolean
Sets the color to neutral.
   
primary
boolean
Sets the color to primary.
   
secondary
boolean
Sets the color to secondary.
   
accent
boolean
Sets the color to accent.
   
info
boolean
Sets the color to info.
   
success
boolean
Sets the color to success.
   
warning
boolean
Sets the color to warning.
   
error
boolean
Sets the color to error.
size
string
Sets the size. Can be set to one of the below size prop names.
    lg
boolean
Sets the size to lg
    md
boolean
Sets the size to md (the default)
    sm
boolean
Sets the size to sm
    xs
boolean
Sets the size to xs