RadioGroup
Pick exactly one option from a short visible list. The card variant makes each option a selectable card.
Status: beta. Category: Forms.
import { RadioGroup, RadioGroupItem } from '@glyphui/ui'
Exports: RadioGroup, RadioGroupItem, radioGroupStyles.
Notes
- Arrow keys move between options; the value type is inferred, so onValueChange receives your union type.
- Wrap in Field to get a label, description and error wired to the group.
Example: Basic
import { Field, RadioGroup, RadioGroupItem } from '@glyphui/ui'
export default function Example() {
return (
<Field label="Notify me about">
<RadioGroup defaultValue="mentions">
<RadioGroupItem value="all" label="All activity" />
<RadioGroupItem
value="mentions"
label="Mentions only"
description="When someone @mentions you."
/>
<RadioGroupItem value="none" label="Nothing" />
</RadioGroup>
</Field>
)
}
Example: Option cards
variant="card" for plans, shipping methods and other rich choices.
import { RadioGroup, RadioGroupItem } from '@glyphui/ui'
import { useState } from 'react'
type Plan = 'free' | 'pro' | 'team'
export default function Example() {
const [plan, setPlan] = useState<Plan>('pro')
return (
<RadioGroup<Plan>
aria-label="Plan"
variant="card"
orientation="horizontal"
value={plan}
onValueChange={setPlan}
>
<RadioGroupItem value="free" label="Free" description="3 projects, community support" />
<RadioGroupItem
value="pro"
label="Pro · $16"
description="Unlimited projects, priority support"
/>
<RadioGroupItem value="team" label="Team · $28" description="SSO, audit log, shared themes" />
</RadioGroup>
)
}
Live page: https://glyphui.xyz/components/radio-group