Radio

free

Radio lets users pick a single option from a short, mutually exclusive set.

Billing plan

Choose the plan applied to this workspace.

import { useState } from 'react';
import Radio from '@/components/ui/radio';

const plans = [

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Radio

Examples

Basic

import Radio from '@/components/ui/radio';

export default function BasicDemo() {
  return (

Group

import { useState } from 'react';
import Radio from '@/components/ui/radio';

const speeds = [

Vertical

import { useState } from 'react';
import Radio from '@/components/ui/radio';

export default function VerticalDemo() {

States

import Radio from '@/components/ui/radio';

export default function StatesDemo() {
  return (

Custom Color

import Radio from '@/components/ui/radio';

export default function CustomColorDemo() {
  return (

Controlled

Current access: write

import { useState } from 'react';
import Radio from '@/components/ui/radio';

const levels = [

API

Radio exposes a single radio input and a compound Radio.Group for single-selection sets.

Radio

Radio accepts the props below plus native props for the underlying input.

PropDescriptionTypeDefault
checkedControls the selected state for standalone usage.boolean-
defaultCheckedInitial selected state for uncontrolled usage.boolean-
valueValue used by Radio.Group to match the selected option and passed through to the input.RadioValue-
radioClassClass names applied to the radio control, used for custom color or local styling.string-
childrenLabel content rendered beside the radio control.ReactNode-
classNameClass names applied to the root label.string-
disabledPrevents interaction and applies disabled styling. Inherited from the group when set there.booleanGroup disabled
readOnlyPrevents the radio from changing state on interaction.boolean-
nameName passed to the input, or inherited from the group.stringGroup name
onChangeCalled with this radio value and the input change event when it becomes selected.RadioChangeHandler-
labelRefRef forwarded to the root label element.Ref<HTMLLabelElement>-
refRef forwarded to the underlying radio input.Ref<HTMLInputElement>-
...nativeInputPropsNative props for the underlying radio input.NativeRadioInputProps-

Radio.Group

Radio.Group accepts the props below plus native props for the root div.

PropDescriptionTypeDefault
valueSelected value shared by the group; the matching radio is selected.RadioValue-
onChangeCalled with the next selected value and the source change event.RadioGroupChangeHandler-
radioClassClass names applied to every radio control in the group.string-
disabledDisables every radio in the group.boolean-
nameName shared by radio inputs inside the group.string-
verticalStacks group items vertically.booleanfalse
childrenRadio items rendered inside the group.ReactNode-
classNameClass names applied to the group root.string-
refRef forwarded to the group root.Ref<HTMLDivElement>-
...nativeDivPropsNative props for the group root div.NativeRadioGroupDivProps-

Types

type RadioValue = string;
type RadioChangeHandler = (
  value: RadioValue,
  event: ChangeEvent<HTMLInputElement>,
) => void;
type RadioGroupChangeHandler = (
  value: RadioValue,
  event: ChangeEvent<HTMLInputElement>,
) => void;
type NativeRadioInputProps = ComponentProps<'input'>;
type NativeRadioGroupDivProps = ComponentProps<'div'>;