PageHeader
The in-page heading with one action.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/page-header.jsonVariants and loading
Saldo tahun 2026 · semua cuti disetujui oleh HR
48 karyawan aktif di 6 departemen
Pilih bulan di kiri untuk melihat slipnya
Selamat pagi, Dimas
Kamis, 17 Desember 2026
When to use
- Under the top bar of a page that has one line of context and/or one page action ("Ajukan cuti").
- Beranda: the greeting variant ("Selamat pagi, Dimas" + date), as plain text under the top bar.
When not to use
- The page name → the AppShell top bar title (pass it as AppShell title). It is the only h1: PageHeader never repeats it.
- Nothing to say and no action → no PageHeader (it renders nothing).
- A heading inside a card → Card header (18).
- More than two page actions → one primary + one secondary here, the rest as row actions or in a DropdownMenu.
Do and don't
Context and the next step, under the top barTop bar "Cuti saya"; under it "Saldo tahun 2026 · semua cuti disetujui oleh HR" + "Ajukan cuti".
The page title twice, or two primaries"Cuti" in the top bar and "Cuti saya" again under it says the same thing twice. "Ajukan cuti" + "Unduh laporan" both blue leaves no next step.
Installation
Add PageHeader 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 { PageHeader } from "@/components/mahr/page-header"| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "greeting" | "default" | greeting builds the line from firstName + local time, and the note from today's date. |
description | string | null | – | One line of context. null while loading shows the skeleton. No description and no action → renders nothing. |
action | ReactElement<typeof Button> | – | One Button. Not allowed with variant="greeting". |
secondaryAction | ReactElement<typeof Button> | – | At most one white (secondary) Button, left of action, gap 12 ("Impor dari Excel" · "Tambah karyawan"). Never a second primary. |
firstName · now | string · Date | – · new Date() | greeting only. Only the first word of the name is shown. |