Form

Radio Group

Presents mutually exclusive choices.

Imports

Use the same component slug for React, Vue, and style token lookup. Do not import components from package roots.

import { RadioGroup, RadioGroupItem } from "@line/abc-def-react/radio-group";
<script setup lang="ts">
import { RadioGroup, RadioGroupItem } from "@line/abc-def-vue/radio-group";
</script>

Shadcn references

Compare the corresponding shadcn React and Vue documentation for the same component slug.

Basic usage

import { RadioGroup, RadioGroupItem } from "@line/abc-def-react/radio-group";
import { Label } from "@line/abc-def-react/label";

export function Example() {
  return (
    <RadioGroup defaultValue="react">
      <div className="flex items-center gap-2">
        <RadioGroupItem id="react" value="react" />
        <Label htmlFor="react">React</Label>
      </div>
      <div className="flex items-center gap-2">
        <RadioGroupItem id="vue" value="vue" />
        <Label htmlFor="vue">Vue</Label>
      </div>
    </RadioGroup>
  );
}
<script setup lang="ts">
import { Field, FieldLabel } from "@line/abc-def-vue/field";
import { RadioGroup, RadioGroupItem } from "@line/abc-def-vue/radio-group";
</script>

<template>
  <RadioGroup default-value="react">
    <Field orientation="horizontal">
      <RadioGroupItem id="react" value="react" />
      <FieldLabel for="react">React</FieldLabel>
    </Field>
    <Field orientation="horizontal">
      <RadioGroupItem id="vue" value="vue" />
      <FieldLabel for="vue">Vue</FieldLabel>
    </Field>
  </RadioGroup>
</template>

Component tokens

Component TokenSemantic TokenDefault Primitive Token
--radio-group-item-border--border-input--color-zinc-200
--radio-group-item-ring--ring--color-zinc-400
--radio-group-item-border-destructive--destructive--color-red-50
--radio-group-item-border-destructive-checked--primary--color-zinc-900
--radio-group-item-border-checked--primary--color-zinc-900
--radio-group-item-bg-checked--primary--color-zinc-900
--radio-group-item-fg-checked--primary-foreground--color-zinc-50
--radio-group-indicator-dot-bg--primary-foreground--color-zinc-50

Composition exports

RadioGroupRadioGroupItem

Usage notes

  • Use when exactly one option is selected.
  • Pair every item with a visible label.
  • Related component tokens use the `radio-group` token group in `@line/abc-def-styles/css`.