Neobrutalism UI LogoNeobrutal UI

Radio Group

A set of checkable buttons—known as radio buttons—where no more than one button can be checked at a time.

Installation

npx neobrutal add radio-group

Usage

import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
import { Label } from "@/components/ui/label"
<RadioGroup defaultValue="option-one">
<div className="flex items-center gap-2">
<RadioGroupItem value="option-one" id="option-one" />
<Label htmlFor="option-one">Option One</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="option-two" id="option-two" />
<Label htmlFor="option-two">Option Two</Label>
</div>
</RadioGroup>

Props

RadioGroup

PropTypeDefaultDescription
defaultValuestring-The value of the radio item that should be checked by default.
valuestring-The controlled value of the radio item to check.
onValueChange(value: string) => void-Event handler called when the value changes.
disabledboolean-When true, prevents the user from interacting with the radio group.

RadioGroupItem

PropTypeDefaultDescription
valuestring-The value given as data for the radio item when submitted in a form.
disabledboolean-When true, prevents the user from interacting with the radio item.
requiredboolean-When true, indicates that the user must check the radio item before the owning form can be submitted.