Radio

A controlled radio group with accessible markup, custom visual styling, and support for hints and disabled states.

Installation

npx @obi/ui add radio

Preview

Usage

'use client';

import { useState } from 'react';
import { RadioGroup, RadioItem } from '@/src/components/Radio/Radio';

export default function Example() {
  const [plan, setPlan] = useState('pro');

  return (
    <RadioGroup name="plan" value={plan} onValueChange={setPlan}>
      <RadioItem value="free" label="Free" hint="Up to 3 projects" />
      <RadioItem value="pro" label="Pro" hint="Unlimited projects" />
      <RadioItem value="enterprise" label="Enterprise" hint="Custom limits" />
    </RadioGroup>
  );
}

Props

NameTypeDefaultDescription
namestringShared name attribute applied to all radio inputs in the group.
valuestringCurrently selected value (controlled).
onValueChange(v: string) => voidCallback fired when the user selects a new option.
classNamestring""Additional classes on the group wrapper.