Forms
Radio Group
Accessible radio button group using fieldset and legend, with vertical and horizontal orientations
Quick Preview
Installation
// Copy the RadioGroup component fromsrc/components/forms/RadioGroup.tsx
Usage
'use client'import { useState } from 'react'import { RadioGroup } from '@/components/forms/RadioGroup'const tracks = [{ value: 'foundation', label: 'Foundation' },{ value: 'production', label: 'Production' },{ value: 'systems', label: 'Professional Systems' },]export default function Example() {const [track, setTrack] = useState('production')return (<RadioGroupname="track"options={tracks}value={track}onValueChange={setTrack}legend="Select a learning track"/>)}
Examples
With Description
Horizontal Orientation
Sizes
sm
md
lg
Disabled
Group disabled
Option disabled
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
options* | RadioOption[] | - | Array of { value, label, description?, disabled? } |
value | string | - | Currently selected value |
onValueChange | (value: string) => void | - | Selection change handler |
name* | string | - | HTML name for the radio group |
legend | string | - | Accessible group label (fieldset legend) |
orientation | "vertical" | "horizontal" | "vertical" | Layout orientation |
size | "sm" | "md" | "lg" | "md" | Radio and label size |
disabled | boolean | false | Disable the entire group |
Features
- โfieldset + legend for screen readers
- โVertical and horizontal orientations
- โPer-option disabled state
- โThree sizes
- โKeyboard navigable
- โClient Component