Page Heading
The <smart-page-heading> component provides a composable page heading region with optional slots for breadcrumbs, banner image, avatar, logo, title, subtitle, meta, stats, actions, and filters. It is independent of <smart-page> and can be used standalone or inside any layout. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract PageHeadingBaseComponent defines the shared API — optional IPageHeadingOptions and cssClass (alias class). PageHeadingStandardComponent is a barebones placeholder concrete implementation. PageHeadingComponent is the public wrapper that renders PageHeadingStandardComponent by default and accepts a custom replacement via PAGE_HEADING_STANDARD_COMPONENT_TOKEN.
Usage
<smart-page-heading [options]="options()" />
@if (lastAction()) {
<p>Last action: {{ lastAction() }}</p>
}
<ng-template #actionsTpl>
<smart-button [options]="editButton">Edit</smart-button>
<smart-button [options]="publishButton">Publish</smart-button>
</ng-template>
The preview renders the code above in an application that registers every preset (provideSmartPresets(), see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Components
PageHeadingComponent (<smart-page-heading>)
Main wrapper component. Renders PageHeadingStandardComponent by default. When PAGE_HEADING_STANDARD_COMPONENT_TOKEN is provided (or provideSmartPresets() registers the preset), renders the injected component via NgComponentOutlet, forwarding options and the class.
PageHeadingStandardComponent (<smart-page-heading-standard>)
Barebones placeholder concrete implementation. Always renders a wrapper <div> and a <header>. Renders any of the optional slots (breadcrumbsTpl, bannerTpl, avatarTpl, logoTpl, metaTpl, statsTpl, actionsTpl, filtersTpl) only when provided; it does not read navTpl or presentation. Renders <h1> with options.title and <p class="subtitle"> with options.subtitle only when those strings are non-empty. The external cssClass is applied to the wrapper. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
PageHeadingBaseComponent (abstract)
Abstract base directive for extending custom page-heading implementations. Exposes options as an InputSignal<IPageHeadingOptions | undefined> and cssClass as an InputSignal<string> (with alias class).
API
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
options | InputSignal<IPageHeadingOptions | undefined> | - | Optional configuration (title, subtitle, slot templates) |
class | InputSignal<string> | '' | External CSS classes (alias for cssClass) |
IPageHeadingOptions
All properties are optional; a section is rendered only when its template or string is provided.
| Field | Type | Default | Description |
|---|---|---|---|
title | string | - | The page title, an <h1> (the preset puts it in the brand zone, after the logoTpl). |
subtitle | string | - | Text under the title. |
actionsTpl | TemplateRef<unknown> | - | Action buttons (the preset's actions zone, hidden below md and repeated in the mobile panel). |
avatarTpl | TemplateRef<unknown> | - | An avatar (the preset shows it in place of the actions in the user layout only). |
logoTpl | TemplateRef<unknown> | - | A logo (the preset's brand zone). |
breadcrumbsTpl | TemplateRef<unknown> | - | Standard only: breadcrumbs above the header. |
bannerTpl | TemplateRef<unknown> | - | Standard only: a banner above the header. |
metaTpl | TemplateRef<unknown> | - | Standard only: meta information (dates, location, counts). |
statsTpl | TemplateRef<unknown> | - | Standard only: a stats row. |
filtersTpl | TemplateRef<unknown> | - | Standard only: filter controls. |
navTpl | TemplateRef<unknown> | - | Preset only: the desktop nav zone (hidden below md, repeated in the mobile panel). |
presentation | { layout?: 'links-left' | 'links-center' | 'links-right' | 'user' } | links-left | Preset only: the arrangement of the bar (see the layouts below). |
PAGE_HEADING_STANDARD_COMPONENT_TOKEN
InjectionToken from @smartsoft001/angular that allows replacing the default PageHeadingStandardComponent with a custom implementation. Provide a Type<PageHeadingBaseComponent> in your application or component providers; provideSmartPresets() provides PageHeadingPresetComponent for it together with every other preset.
Extending the base class
import { NgTemplateOutlet } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
computed,
TemplateRef,
viewChild,
ViewEncapsulation,
} from '@angular/core';
import {
IPageHeadingOptions,
PAGE_HEADING_STANDARD_COMPONENT_TOKEN,
PageHeadingBaseComponent,
PageHeadingComponent,
} from '@smartsoft001/angular';
/**
* A custom page heading built on `PageHeadingBaseComponent`.
*
* The base contributes the `options` and `class` inputs; the implementation
* decides which `TemplateRef` slots of `IPageHeadingOptions` it renders and
* in which order.
*/
@Component({
selector: 'docs-custom-page-heading',
template: `
<div [class]="containerClasses()">
@if (options()?.breadcrumbsTpl) {
<nav class="docs-page-heading__breadcrumbs" aria-label="Breadcrumb">
<ng-container [ngTemplateOutlet]="options()!.breadcrumbsTpl!" />
</nav>
}
<header class="docs-page-heading__header">
<div>
@if (options()?.title) {
<h1 class="docs-page-heading__title">{{ options()!.title }}</h1>
}
@if (options()?.subtitle) {
<p class="docs-page-heading__subtitle">{{ options()!.subtitle }}</p>
}
@if (options()?.metaTpl) {
<div class="docs-page-heading__meta">
<ng-container [ngTemplateOutlet]="options()!.metaTpl!" />
</div>
}
</div>
@if (options()?.actionsTpl) {
<div class="docs-page-heading__actions">
<ng-container [ngTemplateOutlet]="options()!.actionsTpl!" />
</div>
}
</header>
</div>
`,
imports: [NgTemplateOutlet],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomPageHeadingComponent extends PageHeadingBaseComponent {
containerClasses = computed(() => {
const classes = ['docs-page-heading'];
const layout = this.options()?.presentation?.layout;
if (layout) classes.push(`docs-page-heading--${layout}`);
const extra = this.cssClass();
if (extra) classes.push(extra);
return classes.join(' ');
});
}
/**
* Registering the implementation against
* `PAGE_HEADING_STANDARD_COMPONENT_TOKEN` makes every `<smart-page-heading>`
* in this injector render it instead of the standard variation. The slots are
* `<ng-template>` references owned by this host, because
* `IPageHeadingOptions` takes `TemplateRef`s.
*/
@Component({
selector: 'docs-page-heading-custom-example',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [PageHeadingComponent],
providers: [
{
provide: PAGE_HEADING_STANDARD_COMPONENT_TOKEN,
useValue: CustomPageHeadingComponent,
},
],
template: `
<smart-page-heading [options]="options()" />
<ng-template #breadcrumbsTpl>
<a href="#">Jobs</a>
<span aria-hidden="true">/</span>
<span>Engineering</span>
</ng-template>
<ng-template #metaTpl>
<span>Remote</span>
<span>$120k - $140k</span>
</ng-template>
<ng-template #actionsTpl>
<button type="button">Edit</button>
<button type="button">Publish</button>
</ng-template>
`,
})
export class PageHeadingCustomExampleComponent {
breadcrumbsTpl = viewChild<TemplateRef<unknown>>('breadcrumbsTpl');
metaTpl = viewChild<TemplateRef<unknown>>('metaTpl');
actionsTpl = viewChild<TemplateRef<unknown>>('actionsTpl');
options = computed<IPageHeadingOptions>(() => ({
title: 'Back End Developer',
subtitle: 'Full-time, Engineering',
breadcrumbsTpl: this.breadcrumbsTpl(),
metaTpl: this.metaTpl(),
actionsTpl: this.actionsTpl(),
presentation: { layout: 'links-right' },
}));
}
HyperUI preset
PageHeadingPresetComponent (smart-page-heading-preset) is a HyperUI-styled variation. Unlike the standard page-heading (a page title block), this preset intentionally renders a NAVBAR look: a sticky-ready <header> bar with a brand zone (the logoTpl, followed by the title as an <h1> and the subtitle under it), a responsive desktop nav zone, a CTA/actions zone (or a user avatar zone), and a mobile hamburger that toggles a collapsible panel. The collapse is driven by a local menuOpened signal — no external JS runtime. It does not render the breadcrumbs, banner, meta, stats and filters slots.
Register it through PAGE_HEADING_STANDARD_COMPONENT_TOKEN (or with provideSmartPresets()) to restyle every <smart-page-heading>, or use <smart-page-heading-preset> directly. It declares cssClass without the class alias: on the preset selector bind [cssClass]; on <smart-page-heading> pass class as usual.
Layouts (presentation.layout)
| Layout | Arrangement |
|---|---|
links-left | Logo, then nav directly after it, CTAs pushed right (default) |
links-center | Logo left, nav centered, CTAs right |
links-right | Logo left (flex-1), nav + CTAs grouped on the right |
user | Like links-right, but an avatarTpl zone instead of CTAs |
Preset-only IPageHeadingOptions fields
navTpl?: TemplateRef<unknown>— desktop nav content (hidden belowmd, repeated inside the mobile panel when open).presentation?: { layout?: 'links-left' | 'links-center' | 'links-right' | 'user' }— selects the navbar arrangement (defaultlinks-left).
logoTpl, title and subtitle fill the brand zone, actionsTpl the CTA zone and avatarTpl the user zone (user layout).
Example nav recipe
The preset renders only the nav zone wrapper; supply the list via navTpl, as in the template below.
Accents stay teal-600 (light) / teal-300 (dark) per the source template.
Out of scope: avatar dropdown open/close logic — the user supplies the full interactive avatar/menu markup via avatarTpl; the preset only renders the zone (hidden md:relative md:block).
Source
The component lives in packages/shared/angular/src/lib/components/page-heading and is documented for Claude Code by the angular-components-page-heading skill.
SmartPageHeading renders the heading of a page from options: a title and subtitle plus ReactNode slots (breadcrumbs, banner, avatar, logo, meta, stats, actions, filters, nav), each rendered only when given. The standard rendering is unstyled: breadcrumbs and banner above a <header> with the title and the other slots. SmartPageHeadingPreset renders a navbar-like <header> (a brand zone with the logo, the title as an <h1> and the subtitle, a desktop nav, actions or avatar, a mobile toggle) laid out by options.presentation.layout; it reads only title, subtitle, logoTpl, navTpl, actionsTpl, avatarTpl and presentation, so the breadcrumbs, banner, meta, stats and filters slots are rendered by the standard heading only.
Usage
import { useState } from 'react';
import {
IPageHeadingOptions,
SmartButton,
SmartPageHeading,
} from '@smartsoft001/react';
export function PageHeadingUsageExample() {
const [lastAction, setLastAction] = useState<string | null>(null);
const options: IPageHeadingOptions = {
title: 'Back End Developer',
subtitle: 'Full-time, remote',
actionsTpl: (
<>
<SmartButton
options={{
variant: 'secondary',
click: () => setLastAction('edit'),
}}
>
Edit
</SmartButton>
<SmartButton options={{ click: () => setLastAction('publish') }}>
Publish
</SmartButton>
</>
),
};
return (
<>
<SmartPageHeading options={options} />
{lastAction && <p>Last action: {lastAction}</p>}
</>
);
}
The preview renders the code above in an application that registers every preset (SMART_PRESET_COMPONENTS on SmartProvider, see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Exports
All from @smartsoft001/react.
| Export | Kind | What it is |
|---|---|---|
SmartPageHeading | component | Renders the implementation registered as components['page-heading'] on SmartProvider, SmartPageHeadingStandard by default. |
SmartPageHeadingPreset | component | HyperUI-styled page heading variation (preset). |
SmartPageHeadingStandard | component | The default page heading rendering: unstyled breadcrumbs and banner slots above a <header> holding the title, subtitle and the avatar / logo / meta / stats / actions / filters slots. |
The preset's class helpers (getPageHeadingHeaderClasses, getPageHeadingBarClasses) and the PageHeadingPresetLayout type ('links-left' | 'links-center' | 'links-right' | 'user') are exported too, for a custom implementation that wants the preset look.
Props and Types
SmartPageHeadingProps
| Prop | Type | Default | Description |
|---|---|---|---|
options? | IPageHeadingOptions | — | Title, subtitle, slots and presentation. |
className? | string | — | Classes on the root element. |
IPageHeadingOptions
| Field | Type | Default | Description |
|---|---|---|---|
title? | string | — | The page title, an <h1> (the preset puts it in the brand zone, after the logo). |
subtitle? | string | — | Text under the title. |
breadcrumbsTpl? | ReactNode | — | Breadcrumbs above the header (standard). |
metaTpl? | ReactNode | — | Meta information: dates, location, counts (standard). |
avatarTpl? | ReactNode | — | An avatar (the preset's user layout shows it in place of the actions). |
bannerTpl? | ReactNode | — | A banner image above the header (standard). |
actionsTpl? | ReactNode | — | Action buttons. |
statsTpl? | ReactNode | — | A stats row (standard). |
logoTpl? | ReactNode | — | A logo (the preset's brand zone, before the title). |
filtersTpl? | ReactNode | — | Filter controls (standard). |
navTpl? | ReactNode | — | Navigation links (the preset's desktop nav zone and mobile panel). |
presentation? | { layout?: 'links-left' | 'links-center' | 'links-right' | 'user'; } | — | layout of the preset: links-left (default), links-center, links-right or user. |
Replacing the Implementation
SmartPageHeading renders the component registered under the 'page-heading' key of SmartProvider's components, and SmartPageHeadingStandard when nothing is registered there. Every SmartPageHeading below the provider then renders the registered component, which receives the same props.
SmartPageHeadingPreset is the styled (preset) implementation: register it under the 'page-heading' key of SmartProvider's components, render it directly in place of SmartPageHeading, or spread SMART_PRESET_COMPONENTS on the provider to register every preset at once (see the react-provider skill). Pass components as a stable object (a module constant or a memoised value), or the context changes on every render.
import {
IPageHeadingOptions,
SmartPageHeading,
SmartPageHeadingProps,
SmartProvider,
} from '@smartsoft001/react';
/**
* A custom page heading: it receives the props of `SmartPageHeading`
* (`options`, `className`) and decides which `ReactNode` slots of
* `IPageHeadingOptions` it renders and in which order.
*/
export function CustomPageHeading({
options,
className,
}: SmartPageHeadingProps) {
const layout = options?.presentation?.layout;
const classes = [
'docs-page-heading',
layout && `docs-page-heading--${layout}`,
className,
]
.filter(Boolean)
.join(' ');
return (
<div className={classes}>
{options?.breadcrumbsTpl && (
<nav className="docs-page-heading__breadcrumbs" aria-label="Breadcrumb">
{options.breadcrumbsTpl}
</nav>
)}
<header className="docs-page-heading__header">
<div>
{options?.title && (
<h1 className="docs-page-heading__title">{options.title}</h1>
)}
{options?.subtitle && (
<p className="docs-page-heading__subtitle">{options.subtitle}</p>
)}
{options?.metaTpl && (
<div className="docs-page-heading__meta">{options.metaTpl}</div>
)}
</div>
{options?.actionsTpl && (
<div className="docs-page-heading__actions">{options.actionsTpl}</div>
)}
</header>
</div>
);
}
// A module constant: a new object on every render would change the context.
const components = { 'page-heading': CustomPageHeading };
const options: IPageHeadingOptions = {
title: 'Back End Developer',
subtitle: 'Full-time, Engineering',
breadcrumbsTpl: (
<>
<a href="#">Jobs</a>
<span aria-hidden="true">/</span>
<span>Engineering</span>
</>
),
metaTpl: (
<>
<span>Remote</span>
<span>$120k - $140k</span>
</>
),
actionsTpl: (
<>
<button type="button">Edit</button>
<button type="button">Publish</button>
</>
),
presentation: { layout: 'links-right' },
};
/**
* Every `SmartPageHeading` below this provider renders `CustomPageHeading`
* instead of the standard rendering.
*/
export function PageHeadingCustomExample() {
return (
<SmartProvider components={components}>
<SmartPageHeading options={options} />
</SmartProvider>
);
}
Styling
- The standard rendering is unstyled;
SmartPageHeadingPresetcarries the header look with a collapsible mobile panel andsmart:dark:variants.
Source
The component lives in packages/shared/react/src/lib/components/page-heading and is documented for Claude Code by the react-components-page-heading skill.