Skip to Content
Nextra 4.0 is released 🎉

Radio

The Radio component is a pixel-art styled radio button input.
It supports main and inline layouts, custom colors, and disabled state — ideal for single-selection forms and option groups with a retro aesthetic.


🚀 Usage

Basic Example


import { Radio } from "pixelartui-react"; <Radio label="Option A" type="main" name="demo" value="a" onChange={(e) => console.log(e.target.value)} /> <Radio label="Option B" type="main" name="demo" value="b" onChange={(e) => console.log(e.target.value)} />

Inline Layout


<Radio label="Option A" type="inline" name="inline" value="a" /> <Radio label="Option B" type="inline" name="inline" value="b" />

Default Checked


<Radio label="Option A" type="main" name="checked" value="a" defaultChecked /> <Radio label="Option B" type="main" name="checked" value="b" />

Disabled


<Radio label="Disabled" type="main" name="disabled" value="disabled" disabled />

Custom Background


<Radio label="Option A" type="main" name="custom" value="a" backgroundColor="#05EB57" defaultChecked />

Styles


<Radio label="Dark style" type="main" name="dark" value="dark" radioStyle="dark" /> <Radio label="Light style" type="main" name="light" value="light" radioStyle="light" />

🔧 Props

PropTypeDefaultDescription
labelstringLabel text for the radio button.
type"main" | "inline"Layout variant of the radio button.
namestringName attribute for the input group.
valuestringValue for the radio button.
defaultCheckedbooleanfalseInitial checked state.
checkedbooleanundefinedControlled checked state.
noLabelbooleanundefinedHides the label when true.
backgroundColorstringundefinedCustom background color for the radio indicator.
radioStyle"dark" | "light""dark"Applies a light or dark theme to the component.
disabledbooleanfalseDisables interaction with the radio button.
classNamestringundefinedAdds additional CSS classes for custom styling.
onChange(e: React.ChangeEvent<HTMLInputElement>) => voidundefinedCallback fired when the radio button state changes.
Last updated on