Checkbox & ChoiceCard

Yes/no choices inside a form.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/checkbox.json

Checkbox states

24 box · off --check-edge · on primary + white check · indeterminate bar · disabled 60 %. The label is part of the hit area.

With description (inside a form)

Checkbox LEFT of the label, gap 12; description 14 under it.

ChoiceCard

Raised (--shadow-button), never line-drawn. Selected: inset 2px --primary ring on the white card (no blue fill). A full-width card can carry a description.

Apa yang mau diubah?

When to use

  • A yes/no choice inside a form that is submitted with a button (Tanpa batas, Prorata, Wajib lampiran, Ikut BPJS).
  • Several options the user can tick at once, as ChoiceCards ("Apa yang mau diubah?").

When not to use

  • A setting that applies at once, outside a form → Switch.
  • Exactly one of several options → RadioGroup / RadioCard.
  • 2–4 short values, one at a time → SegmentedControl.

Which one?

Does the choice apply at once (no Simpan button)?├─ Yes → Switch└─ No (part of a form)   Can the user pick more than one option?   ├─ Yes → Checkbox (short list) or ChoiceCard group (options read as things)   └─ No  → RadioGroup / RadioCard (with descriptions) or SegmentedControl (2–4 short words)

Do and don't

DoWrite the choice as a statement"Wajib lampiran": checked means yes. The description says what it causes.
Don'tA Switch inside a Sheet formA Switch says "this applies now". In a form that waits for Simpan, it lies. Use a Checkbox.

Installation

Add Checkbox & ChoiceCard 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/checkbox.json

API

Checkbox

import { Checkbox } from "@/components/ui/checkbox"
PropTypeDefaultDescription
checked · defaultChecked · onCheckedChangeboolean · (checked) => void–Controlled or uncontrolled.
indeterminatebooleanfalse"Pilih semua" with a partial selection.
disabled · required · name · valueBase UI Checkbox.Root props–Wrap with <Label> for the hit area.
aria-invalidboolean–2px --danger edge.

ChoiceCard

import { ChoiceCard } from "@/components/ui/choice-card"
PropTypeDefaultDescription
labelReactNode–16 / 600.
descriptionReactNode–14 grey, next to or under the label.
…Checkbox propsCheckbox.Root props–checked, defaultChecked, onCheckedChange, disabled.