Skip to content
Nana UI

Layout & Containers

Page Header

The top of a page: a breadcrumb, the title with a line about it, and the page's actions in one row.

View .md Download

Start every page of an app with a page header, so the title, where the page sits and what can be done on it are always in the same place. On a wide screen the actions sit to the right of the title; on a phone they move under it.

Home Claims Motor Export New claim

Motor claims

Claims filed against motor policies this month, newest first.

Install the package for a versioned dependency:

npm install @nana-tec/ui-components

Or copy the source in and own it:

npx @nana-tec/ui add page-header --framework web-components
npx @nana-tec/ui add page-header --framework svelte

Lands in src/lib/components/ui/page-header/ as NanaPageHeader.svelte, styled with Tailwind classes that resolve to the design tokens. Requires Tailwind v4.

Import the autoloader once, in your app's entry point. Every <nana-*> tag then works anywhere, and each component downloads only the first time a page uses it:

import "@nana-tec/ui-components/autoloader";
import "@nana-tec/ui-components/theme";

The second line gives every component the Nana look and the design tokens behind it. Leave it out to style the components entirely yourself.

Import a component directly when it must be ready at once: on screen at first paint, or when you call its methods straight away. The two mix freely:

import "@nana-tec/ui-components/page-header";

Copied in with npx @nana-tec/ui add page-header? Import your project's own @/lib/nana-ui/autoloader.js once instead; the CLI keeps it up to date.

Give the header a heading and, if it helps, a description. Put a breadcrumb in the breadcrumb slot and buttons in the actions slot. Anything else, such as tabs or filters, goes in the default slot under the title row.

<nana-page-header heading="Claims" description="Every claim filed this month.">
<nana-breadcrumb slot="breadcrumb">…</nana-breadcrumb>
<nana-button slot="actions">New claim</nana-button>
<nana-tab-group>…</nana-tab-group>
</nana-page-header>

For a title with markup, such as a reference number in bold, use the heading slot instead of the property. The description slot works the same way.

Give the header a heading and, if it helps, a description, as text or as a snippet. The breadcrumb and actions snippets fill their places; children go under the title row, for tabs or filters.

<script lang="ts">
import { NanaPageHeader } from '$lib/components/ui/page-header';
</script>
<NanaPageHeader heading="Claims" description="Every claim filed this month.">
{#snippet breadcrumb()}<NanaBreadcrumb items={trail} />{/snippet}
{#snippet actions()}<NanaButton>New claim</NanaButton>{/snippet}
<NanaTabs …></NanaTabs>
</NanaPageHeader>

Any part left out takes no space.

The title is a level-one heading, since it names the page. A header for a part of a page, such as a settings panel, takes level 2 or 3, which also makes the title smaller.

Set divider to draw a line under the header, when the content below starts without a border of its own.

  • Use one level-one page header per page, so the title is the page’s main heading.
  • Keep the actions to two or three. Move the rest into a menu, so the row does not wrap on a small screen.
  • Name the breadcrumb, for example aria-label="Breadcrumb"; Nana’s breadcrumb does this for you.

Properties

PropertyAttributeTypeDefaultDescription
descriptiondescriptionstring''A short line under the title.
dividerdividerbooleanfalseDraws a line under the header.
headingheadingstring''The page title.
levellevelnumber1Heading level of the title: 1 for the page, 2 or 3 for a header inside it.

Slots

SlotDescription
(default)Content under the title row, such as tabs or filters
breadcrumbA nana-breadcrumb above the title
headingRich title content, in place of the heading property
descriptionRich description content, in place of the description property
actionsButtons for the page, such as Export or New

CSS parts

PartDescription
::part(base)The header container
::part(breadcrumb)The wrapper around the breadcrumb
::part(row)The row holding the title and the actions
::part(heading)The page title
::part(description)The line under the title
::part(actions)The wrapper around the actions
::part(content)The wrapper around the content under the row

CSS custom properties

PropertyDescription
--nana-page-header-gapSpace between the breadcrumb, the row and the content

NanaPageHeader

PropTypeDefault
idstringuid('nana-page-header')
headingrequiredText
descriptionText
levelPageHeaderLevel1
dividerbooleanfalse
breadcrumbSnippet
actionsSnippet
childrenSnippet

Also accepts Omit<HTMLAttributes<HTMLElement>, 'class' | 'id'>.

heading is required; it and description take text or a snippet. level is 1, 2 or 3. divider draws the line underneath. breadcrumb and actions are snippets, and children render under the title row.