Radio Component

The Radio component allows users to select a single option from a list of choices. It provides various customization options for size, color, and appearance.

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the radio button is checked
size"xs" | "sm" | "md" | "lg" | "xl""md"Sets the size of the radio button
variant"primary" | "secondary" | "success" | "warning" | "error" | "ghost""primary"Sets the color variant of the radio button
labelstringundefinedLabel text for the radio button
isButtonbooleanfalseRenders the radio as a button
wrapperClassstring""Additional CSS classes for the wrapper element
sxReact.CSSProperties{}Custom styles to be applied to the radio button

Usage

import { Radio } from 'knoxui-react';

const [selectedValue, setSelectedValue] = useState('');

<Radio
  checked={selectedValue === 'option1'}
  onChange={() => setSelectedValue('option1')}
  label="Option 1"
/>

Examples

Basic Usage

Sizes

Variants

Button Style

Custom Styling

Ghost Variant Behavior