Controls

Radio Group

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Radio Group

Radio Group

A list of options where the pick glides from one to the next.

Installation

npx shadcn@latest add ikislay/pixel-ui/radio-group

How to use

import { RadioGroup } from "@/components/ui/radio-group"
export function Demo() {
return (
<RadioGroup
aria-label="Plan"
defaultValue="monthly"
options={[
{ value: "monthly", label: "Monthly" },
{ value: "yearly", label: "Yearly", description: "Two months free" },
]}
/>
)
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
options*
{ value: string; label: ReactNode; description?: ReactNode; disabled?: boolean }[]

The choices, in order. A description shows under its label.

value
string

Controls the picked option. Leave it unset to let the group manage itself.

defaultValue
string

The starting pick when uncontrolled. Nothing is picked by default.

onValueChange
(value: string) => void

Called with the newly picked value.

onFeedback
(event: "select") => void

Called at each semantic moment, for wiring sound or haptics.

className
string

Merged onto the root element.