Skip to content

Radio

Radio with spring-scale inner dot animation. Use RadioGroup for mutually exclusive selection.

Basic Usage

tsx
import { Radio, RadioGroup } from '@airo-ui/react'
import { useState } from 'react'

function Demo() {
  const [value, setValue] = useState('opt-2')

  return (
    <div>
      <RadioGroup value={value} onChange={setValue}>
        <Radio value="opt-1" label="Option 1" />
        <Radio value="opt-2" label="Option 2" />
        <Radio value="opt-3" label="Option 3" />
      </RadioGroup>
      <p style={{ marginTop: 8, fontSize: 13, color: 'var(--color-neutral-500)' }}>
        Selected: {value}
      </p>
    </div>
  )
}

Disabled

tsx
<RadioGroup value="opt-1">
  <Radio value="opt-1" label="Enabled" />
  <Radio value="opt-2" label="Disabled" disabled />
</RadioGroup>

API

Radio Props

NameTypeDefaultDescription
valuestring | number | booleanRequiredThe option's value
checkedboolean--Controlled checked state
defaultCheckedbooleanfalseDefault checked state (uncontrolled)
labelstring--Label text
namestring--Native name (can omit inside Group)
disabledbooleanfalseDisabled
childrenReact.ReactNode--Custom label content
onChange(value: RadioValue) => void--Selection change handler

RadioGroup Props

NameTypeDefaultDescription
valuestring | number | boolean--Currently selected value
defaultValuestring | number | boolean--Default selected value
namestring--Group name, auto-passed to children
disabledbooleanfalseDisable entire group
childrenReact.ReactNode--Radio items
onChange(value: RadioValue) => void--Value change handler

MIT License