Veil UI
Components

Radio Group

A single-choice group with roving focus from Radix Radio Group.

Installation

$ npx veil-ui@latest add radio-group

Usage

import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Label } from "@/components/ui/label";

<RadioGroup defaultValue="standard" aria-label="Plan">
  <div className="flex items-center gap-2">
    <RadioGroupItem value="standard" id="standard" />
    <Label htmlFor="standard">Standard</Label>
  </div>
</RadioGroup>;

Examples

Basic

With Description

For individuals and small teams.

SSO, audit logs and dedicated support.

API reference

The package exports radio-group along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.

Accessibility

  • RadioGroup uses Radix roving focus: arrow keys change the selected item and the group exposes radiogroup semantics.
  • Error and disabled states are exposed through native attributes and Radix data attributes.
  • Focus-visible rings follow the shared token system in both themes.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add radio-group --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { RadioGroupRoot } from "reka-ui";

import { cn } from "@/lib/utils";

const props = withDefaults(
  defineProps<{
    class?: string;
    defaultValue?: string;
    disabled?: boolean;
    orientation?: "horizontal" | "vertical";
    loop?: boolean;
    name?: string;
    required?: boolean;
  }>(),
  { disabled: false, loop: true },
);

const model = defineModel<string>();
</script>

<template>
  <RadioGroupRoot
    v-model="model"
    data-slot="radio-group"
    :default-value="defaultValue"
    :disabled="disabled"
    :orientation="orientation"
    :loop="loop"
    :name="name"
    :required="required"
    :class="cn('grid gap-2', props.class)"
  >
    <slot />
  </RadioGroupRoot>
</template>

On this page