DetailCard

Key-value rows with one access mode.

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

Access modes

Three modes, set by permission, never by taste: locked (lock + "Diatur oleh HR", no click target) · editable (secondary "Ubah" with edit icon → onEdit opens a Sheet) · request (Button link "Minta perubahan ke HR": blue, because it sends a request). Missing value = "–". Long values wrap to max 3 lines.

Pekerjaan

Diatur oleh HR
DepartemenEngineering
JabatanBackend engineer
AtasanIndra Wijaya

Kontak darurat

NamaSari Pratiwi
HubunganIstri
Telepon0812 7730 1945

Data pribadi

Telepon0813 2045 7781
AlamatJl. Tebet Barat Dalam IV No. 12, RT 05/RW 02, Jakarta Selatan
Golongan darah–

Rekening & pajak

RekeningBCA •••• 4521
NIK3174 •••• •••• 0007
Status PTKPK/0

Admin record: no tile, trailing eye, footer, readonly

On Karyawan · Detail the cards have no icon tile. A row may have ONE trailing control: the salary eye (ghost IconButton 44, aria-pressed, eye ↔ eye-off). Its slot overlaps the row padding, so the row stays 56 when the value changes. footer = one CardFooterLink at the card's bottom edge. readonly = no header action (an archived record). labelWidth: 160 by default, 120 in a 400 wide card.

Gaji

Gaji pokokRp ••••••
RekeningBCA •••• 7890
NPWPTerdaftar · TK/0

Keluar

Tanggal keluar30 Sep 2026
AlasanMengundurkan diri
Gaji terakhirSep 2026

Pending request and loading

Pending → inline warning Callout and the action becomes nav "Lihat permintaan" (a second request is not possible while one waits). Loading: header stays real, values skeleton, action disabled.

Rekening & pajak

Permintaan perubahan dikirim 17 Des. Data lama tetap dipakai sampai HR mengubahnya.
RekeningBCA •••• 4521
NPWP09.254.•••.•-014.000

Kontak darurat

Nama
Hubungan
Telepon

When to use

  • Profil saya: Pekerjaan, Kontak darurat, Data pribadi, Rekening & pajak (2×2 grid).
  • Karyawan Detail (admin): Pekerjaan, Cuti, Data pribadi, Gaji.
  • Pengaturan sections (Profil perusahaan, Jadwal gaji).

When not to use

  • Values that change every month (saldo, gaji bersih) → StatTile.
  • A list of many records → Table or Card + ListRow.
  • Editing in place inside the card → never; "Ubah" opens a Sheet with only this card's fields.
  • The person's identity at the top of a page → ProfileCard header.

Do and don't

DoGroup by who may change itTelepon and Alamat sit in "Data pribadi" (Ubah); Rekening, NIK, NPWP in "Rekening & pajak" (Minta perubahan). One card = one permission.
Don'tA pencil on every row, or two header actionsPer-row edit icons make 20 tiny targets for older users. "Ubah" + "Minta perubahan" in one header means the card mixes permissions: split it.

Installation

Add DetailCard 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/detail-card.json

API

import { DetailCard } from "@/components/mahr/detail-card"
PropTypeDefaultDescription
title · descriptionstring · string?–description = one muted line under the title ("Dibayar tiap tanggal 25.").
icon · moduleNeatIcon? · ModuleId– · "karyawan"Optional tile; module sets its colours. Admin record pages have no tile.
access"editable" | "request" | "locked" | "readonly""locked"Comes from the user's permission, not from the page. readonly = no action (archived record).
rows{ label; value: ReactNode | null; trailing?; emphasis?; alignValue?: "left" | "right" }[]–null → "–". Max 6 rows; more → split the card. trailing = ONE IconButton; the row stays 56. emphasis = a total row (bg-background, 600).
labelWidth · footernumber · ReactNode160 · –Label column in px (120 in a 400 wide card). footer = one CardFooterLink, pinned to the bottom.
onEdit · onRequest() => void–editable → onEdit (opens Sheet). request → onRequest.
pendingRequest · loading{ sentAt, href?, render? } | null · booleannull · falsePending shows the inline warning Callout and swaps the action to "Lihat permintaan".
error · onRetryboolean · () => voidfalseFailed load: the header stays; the rows' space shows "Gagal dimuat." + secondary "Coba lagi" at the same height (shared LoadError pattern).