PageHeader

The in-page heading with one action.

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

Variants and loading

Two variants, nothing else (no title, no breadcrumb, no tabs). The row is at least 44 px, so it does not jump when an action comes or goes. Greeting by local time: pagi 04–10, siang 11–14, sore 15–17, malam 18–03; first name only; no action; plain text at section size (22), not a heading. Loading: the description becomes a skeleton in its own 24 px line, the action shows disabled.

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

DoContext and the next step, under the top barTop bar "Cuti saya"; under it "Saldo tahun 2026 · semua cuti disetujui oleh HR" + "Ajukan cuti".
Don'tThe 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.

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

API

import { PageHeader } from "@/components/mahr/page-header"
PropTypeDefaultDescription
variant"default" | "greeting""default"greeting builds the line from firstName + local time, and the note from today's date.
descriptionstring | null–One line of context. null while loading shows the skeleton. No description and no action → renders nothing.
actionReactElement<typeof Button>–One Button. Not allowed with variant="greeting".
secondaryActionReactElement<typeof Button>–At most one white (secondary) Button, left of action, gap 12 ("Impor dari Excel" · "Tambah karyawan"). Never a second primary.
firstName · nowstring · Date– · new Date()greeting only. Only the first word of the name is shown.