RadioGroup
Pick one option with a description.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/radio-group.jsonList with descriptions
Peran
RadioCard and inline
Jika saldo kurang
Punya NPWP?
When to use
- Pick exactly one option when each option needs a description: Peran, Jika saldo kurang, Jadwal gaji.
- A short yes/no inside a form: Punya NPWP? Ya / Tidak.
When not to use
- 2–4 short words with no description, picked often → SegmentedControl.
- 5 or more options → Select.
- More than one option at once → Checkbox / ChoiceCard.
Do and don't
Say what each option causes"Saldo bisa minus. HR yang menyetujui.": the user does not need to guess.
Radios with no defaultPre-select the safe option (Ditolak). An empty radio group is a question the user may skip.
Installation
Add RadioGroup with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { RadioGroup, RadioGroupItem, RadioOption, RadioCard } from "@/components/ui/radio-group"| Prop | Type | Default | Description |
|---|---|---|---|
value · defaultValue · onValueChange | string · (value) => void | – | One value. |
disabled · name · required | Base UI RadioGroup props | – | |
RadioOption · RadioCard label · description | ReactNode | – | Plus Radio props: value, disabled. |
RadioGroupItem value · disabled | string · boolean | – | Bare radio; wrap in <Label>. |