RadioGroup

Pick one option with a description.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/radio-group.json

List with descriptions

Radio 24 · gap 12 · label 16/600 · description 14 grey.

Peran

RadioCard and inline

RadioCard is raised; selected = inset 2px primary ring on the white card (no blue fill). Inline radios for Ya / Tidak; disabled 60 %.

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

DoSay what each option causes"Saldo bisa minus. HR yang menyetujui.": the user does not need to guess.
Don'tRadios 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.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/radio-group.json

API

import { RadioGroup, RadioGroupItem, RadioOption, RadioCard } from "@/components/ui/radio-group"
PropTypeDefaultDescription
value · defaultValue · onValueChangestring · (value) => void–One value.
disabled · name · requiredBase UI RadioGroup props–
RadioOption · RadioCard label · descriptionReactNode–Plus Radio props: value, disabled.
RadioGroupItem value · disabledstring · boolean–Bare radio; wrap in <Label>.