The top of an admin page: breadcrumb, title, description, actions and tabs.
$ pnpm dlx shadcn@latest add @dashral/page-headerInstallation
$ pnpm dlx shadcn@latest add @dashral/page-headerAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/page-header.json
Usage
import { Button } from "@/components/dashral/button"
import { PageHeader } from "@/components/dashral/page-header"
<PageHeader
breadcrumb={[{ label: "Billing", href: "/billing" }, { label: "Invoices" }]}
title="Invoices"
description="Everything you've billed this year."
actions={<Button>New invoice</Button>}
/>Using the npm package? Import from @dashral/ui/components/page-header instead, here and in the examples; the rest is the same.
Examples
A record's page
A back link, a badge beside the title, and a row of details.
INV-1048
OverdueAPI reference
PageHeader
Also takes every prop of <header>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
title | ReactNodeThe page's heading. Required. | — |
description | ReactNodeA line under the title. | — |
titleAs | "h1" | "h2"The heading's level. | "h1" |
breadcrumb | BreadcrumbItem[]The trail above the title, drawn with Breadcrumb. | — |
back | { href, label }A link back above the title, instead of a breadcrumb. | — |
badge | ReactNodeBeside the title, e.g. a status. | — |
meta | ReactNodeA row of details under the title. | — |
actions | ReactNodeThe page's buttons; on a phone they wrap under the title. | — |
tabs | ReactNodeUnder everything, e.g. Tabs with variant="line". | — |
divided | booleanA line under the header (under the tabs, with tabs). | false |
size | "sm" | "default"sm for a panel or a settings section. | "default" |
linkAs | ElementTypeYour router's link, for the breadcrumb and the back link. | "a" |
classNames | { title, description, meta, actions }Classes for each part. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Accessibility
- A <header> with a real heading (h1 by default): keep one h1 per page.
- The breadcrumb is a navigation landmark; the back link's arrow is decoration.