@molecule/app-page-chrome-angular
Feature · page-chrome · App (browser) · v1.1.2 · Apache-2.0
Angular page-header / hero-section primitives for SaaS apps
npm install @molecule/app-page-chrome-angularHow it works
@molecule/app-page-chrome-angular is a ready-made page-chrome feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { Component } from '@angular/core'
import { HeroSection, PageHeader } from '@molecule/app-page-chrome-angular'
@Component({
selector: 'app-projects',
standalone: true,
imports: [PageHeader, HeroSection],
template: `
<header mol-page-header>
<span slot="title">Projects</span>
<span slot="subtitle">Manage your active projects</span>
<button slot="actions" type="button" (click)="open = true">New project</button>
</header>
<section mol-hero-section>
<span slot="eyebrow">Welcome back</span>
<span slot="title">Your workspace</span>
<span slot="description">Everything you need to ship faster.</span>
</section>
`,
})
export class ProjectsPage {
open = false
}Works with: @molecule/app-angular, @molecule/app-ui, @molecule/app-ui-angular
Reference
Angular page-header and hero-section primitives — the counterpart of
@molecule/app-page-chrome-react: the same props (React names), the same
DOM for the same input.
Exports:
<PageHeader>— top-of-page header with breadcrumbs + title/subtitle + leading icon + right-aligned actions + meta row.emphasis="extrabold"switches the title to the larger dashboard treatment.<HeroSection>— dashboard/landing hero with text + optional media column;align="center"for marketing-style heroes.
Both accept className for per-brand accent styling and dataMolId for
AI-agent selectors. Node props are projected content: give each one
slot="<name>" in the host template.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { Component } from '@angular/core'
import { HeroSection, PageHeader } from '@molecule/app-page-chrome-angular'
@Component({
selector: 'app-projects',
standalone: true,
imports: [PageHeader, HeroSection],
template: `
<header mol-page-header>
<span slot="title">Projects</span>
<span slot="subtitle">Manage your active projects</span>
<button slot="actions" type="button" (click)="open = true">New project</button>
</header>
<section mol-hero-section>
<span slot="eyebrow">Welcome back</span>
<span slot="title">Your workspace</span>
<span slot="description">Everything you need to ship faster.</span>
</section>
`,
})
export class ProjectsPage {
open = false
}
Type
feature
Installation
npm install @molecule/app-page-chrome-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
API
Interfaces
PageHeaderProps
Props accepted by PageHeader — the same props
@molecule/app-page-chrome-react accepts. Node props (title, subtitle,
icon, breadcrumbs, actions, meta) are projected content in Angular
(an input cannot carry a node), so they are typed unknown: pass them in
the host template with slot="<name>", not as values.
interface PageHeaderProps {
/** Primary heading, projected as `[slot=title]` content. */
title?: unknown
/** Optional subheading, projected as `[slot=subtitle]` content. */
subtitle?: unknown
/** Optional leading icon, projected as `[slot=icon]` content. */
icon?: unknown
/** Optional breadcrumb trail, projected as `[slot=breadcrumbs]` content. */
breadcrumbs?: unknown
/** Right-aligned actions, projected as `[slot=actions]` content. */
actions?: unknown
/** Optional meta row, projected as `[slot=meta]` content. */
meta?: unknown
/**
* Title emphasis level. Both values resolve their weight through
* `cm.fontWeight(...)`, so the class is a real, theme-scanned utility.
* - `'normal'` (default) — 3xl `cm.fontWeight('bold')`, for general /
* reusable list-page headers.
* - `'extrabold'` — the larger 4xl `cm.fontWeight('extrabold')` dashboard
* treatment (`font-extrabold` is safelisted by `@molecule/app-ui-tailwind`'s
* base.css, so it always generates).
*/
emphasis?: 'normal' | 'extrabold'
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
/** Extra classes on the outer wrapper. */
className?: string
}
HeroSectionProps
Props accepted by HeroSection — the same props
@molecule/app-page-chrome-react accepts. Node props (eyebrow, title,
description, primaryAction, secondaryAction, media) are projected
content in Angular, so they are typed unknown: pass them in the host
template with slot="<name>".
interface HeroSectionProps {
/** Small eyebrow line above the headline, projected as `[slot=eyebrow]` content. */
eyebrow?: unknown
/** Primary headline, projected as `[slot=title]` content. */
title?: unknown
/** Supporting description, projected as `[slot=description]` content. */
description?: unknown
/** Primary call-to-action, projected as `[slot=primaryAction]` content. */
primaryAction?: unknown
/** Optional secondary call-to-action, projected as `[slot=secondaryAction]` content. */
secondaryAction?: unknown
/** Optional visual / illustration slot, projected as `[slot=media]` content. */
media?: unknown
/** Horizontal alignment — defaults to `start`. */
align?: 'start' | 'center'
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Classes
HeroSection
HeroSection component.
Dashboard / landing hero: text column on the left, optional media on the
right. The host IS the outer <section> (section[mol-hero-section]),
matching React's root exactly. Alignment defaults to start for
dashboards; use align="center" for marketing-style landing heroes.
Node props are projected content: eyebrow is [slot=eyebrow], title
[slot=title], description [slot=description], primaryAction
[slot=primaryAction], secondaryAction [slot=secondaryAction] and
media [slot=media]. React omits the eyebrow, the description paragraph,
the action row and the media column when their node is absent, and swaps
the root's horizontal justification when media is present — so those
wrappers are removed while their projection is empty, restored in place
when content is projected again, and the root class follows the media
column's presence.
@Component({
selector: 'section[mol-hero-section]',
standalone: true,
hostDirectives: [MolPlacement],
inputs: ['align', 'className', 'dataMolId'],
host: {
'[attr.data-mol-id]': 'dataMolId ?? null',
},
template: `<div [class]="textColumnClasses()">
<div #eyebrowEl [class]="eyebrowClasses()">
<ng-content select="[slot=eyebrow]"></ng-content>
</div>
<h1 [class]="titleClasses()"><ng-content select="[slot=title]"></ng-content></h1>
<p #descriptionEl [class]="descriptionClasses()">
<ng-content select="[slot=description]"></ng-content>
</p>
<div #actionsEl [class]="actionsClasses()">
<ng-content select="[slot=primaryAction]"></ng-content
><ng-content select="[slot=secondaryAction]"></ng-content>
</div>
</div>
<div #mediaEl [class]="mediaClasses()"><ng-content select="[slot=media]"></ng-content></div>`,
})
export class HeroSection {
/** The host element: the root `<section>` React renders. */
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef)
/** Horizontal alignment — defaults to `'start'` at read time. */
align?: 'start' | 'center'
/** Extra classes. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
/** The eyebrow line (React renders it only while an eyebrow exists). */
@ViewChild('eyebrowEl') eyebrowEl?: ElementRef<HTMLElement>
/** The description paragraph (React renders it only while a description exists). */
@ViewChild('descriptionEl') descriptionEl?: ElementRef<HTMLElement>
/** The action row (React renders it only while an action exists). */
@ViewChild('actionsEl') actionsEl?: ElementRef<HTMLElement>
/** The media column (React renders it only while media exists). */
@ViewChild('mediaEl') mediaEl?: ElementRef<HTMLElement>
/** Whether the media column carries content (drives the root's justification). */
private readonly media = signal(false)
constructor() {
usePlacement((hasContent) => this.sync(hasContent))
}
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* The root class: the flex row (justified `between` while a media column
* exists, else `start`), vertical padding, and `className`.
* @returns The class string.
*/
classes(): string {
return this.cm().cn(
this.cm().flex({
align: 'center',
justify: this.mediaPresent() ? 'between' : 'start',
gap: 'lg',
wrap: 'wrap',
}),
this.cm().sp('py', 10),
this.className,
)
}
/**
* The text column's class (`cm.stack(4)` + `cm.flex1`, centered when `align="center"`).
* @returns The class string.
*/
textColumnClasses(): string {
return this.cm().cn(
this.cm().stack(4),
this.cm().flex1,
this.align === 'center' ? this.cm().textCenter : undefined,
)
}
/**
* The eyebrow line's class (`cm.textSize('sm')` + `cm.fontWeight('semibold')`).
* @returns The class string.
*/
eyebrowClasses(): string {
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
}
/**
* The headline's class (`cm.textSize('4xl')` + `cm.fontWeight('bold')`).
* @returns The class string.
*/
titleClasses(): string {
return this.cm().cn(this.cm().textSize('4xl'), this.cm().fontWeight('bold'))
}
/**
* The description paragraph's class (`cm.textSize('lg')` + `cm.maxW('2xl')`).
* @returns The class string.
*/
descriptionClasses(): string {
return this.cm().cn(this.cm().textSize('lg'), this.cm().maxW('2xl'))
}
/**
* The action row's class (`cm.flex({ align: 'center', gap: 'sm', wrap: 'wrap' })`).
* @returns The class string.
*/
actionsClasses(): string {
return this.cm().flex({ align: 'center', gap: 'sm', wrap: 'wrap' })
}
/**
* The media column's class (`cm.shrink0`), through `cn()` so a token that is
* a function in the bonded map resolves to its string.
* @returns The class string.
*/
mediaClasses(): string {
return this.cm().cn(this.cm().shrink0)
}
/**
* Whether a media column is present, as React's `media ? … : …` sees it.
* @returns True while media content exists.
*/
mediaPresent(): boolean {
return this.media()
}
/**
* Withholds the optional regions React omits, restores the ones with content,
* and writes the root class: its justification follows the media column,
* which only the projected DOM can tell us, so it is set here instead of by
* a binding (a binding would read a value that changes within the same check).
*
* @param hasContent - Reads whether a slot has content.
*/
private sync(hasContent: SlotReader): void {
const eyebrow = this.eyebrowEl?.nativeElement
setElementPresent(eyebrow, hasContent(eyebrow))
const description = this.descriptionEl?.nativeElement
setElementPresent(description, hasContent(description))
const actions = this.actionsEl?.nativeElement
setElementPresent(actions, hasContent(actions))
const media = this.mediaEl?.nativeElement
const mediaPresent = hasContent(media)
this.media.set(mediaPresent)
setElementPresent(media, mediaPresent)
this.host.nativeElement.setAttribute('class', this.classes())
}
}
PageHeader
PageHeader component.
Standard page-top header with optional breadcrumbs, leading icon,
title / subtitle pair, meta row, and right-aligned actions. The host IS the
outer <header> (header[mol-page-header]), matching React's root exactly.
Layout: breadcrumbs, then a two-column row with title+subtitle on the left
and actions on the right, then optional meta.
Node props are projected content: breadcrumbs is [slot=breadcrumbs],
icon [slot=icon], title [slot=title], subtitle [slot=subtitle],
actions [slot=actions] and meta [slot=meta]. React omits the
subtitle paragraph, the action row and the meta row when their node is
absent, so those wrappers are removed while their projection is empty and
restored in place when content is projected again.
@Component({
selector: 'header[mol-page-header]',
standalone: true,
hostDirectives: [MolPlacement],
inputs: ['emphasis', 'className', 'dataMolId'],
host: {
'[class]': 'classes()',
'[attr.data-mol-id]': 'dataMolId ?? null',
},
template: `<ng-content select="[slot=breadcrumbs]"></ng-content>
<div [class]="rowClasses()">
<div [class]="leftClasses()">
<ng-content select="[slot=icon]"></ng-content>
<div [class]="stackClasses()">
<h1 [class]="titleClasses()"><ng-content select="[slot=title]"></ng-content></h1>
<p #subtitleEl [class]="subtitleClasses()">
<ng-content select="[slot=subtitle]"></ng-content>
</p>
</div>
</div>
<div #actionsEl [class]="leftClasses()">
<ng-content select="[slot=actions]"></ng-content>
</div>
</div>
<div #metaEl [class]="metaClasses()"><ng-content select="[slot=meta]"></ng-content></div>`,
})
export class PageHeader {
/** Title emphasis level (`'normal'` by default at read time). */
emphasis?: 'normal' | 'extrabold'
/** Extra classes on the outer wrapper. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
/** The subtitle paragraph (React renders it only while a subtitle exists). */
@ViewChild('subtitleEl') subtitleEl?: ElementRef<HTMLElement>
/** The action row (React renders it only while an action exists). */
@ViewChild('actionsEl') actionsEl?: ElementRef<HTMLElement>
/** The meta row (React renders it only while meta exists). */
@ViewChild('metaEl') metaEl?: ElementRef<HTMLElement>
constructor() {
usePlacement((hasContent) => this.sync(hasContent))
}
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* Computes the wrapper class list (`cm.stack(3)` plus `className`).
* @returns The class string.
*/
classes(): string {
return this.cm().cn(this.cm().stack(3), this.className)
}
/**
* The title row's class (`cm.flex({ justify: 'between', align: 'start', gap: 'md' })`).
* @returns The class string.
*/
rowClasses(): string {
return this.cm().flex({ justify: 'between', align: 'start', gap: 'md' })
}
/**
* The icon + title column's class (`cm.flex({ align: 'center', gap: 'sm' })`).
* @returns The class string.
*/
leftClasses(): string {
return this.cm().flex({ align: 'center', gap: 'sm' })
}
/**
* The title/subtitle stack's class (`cm.stack(1)`).
* @returns The class string.
*/
stackClasses(): string {
return this.cm().stack(1)
}
/**
* The title's class: 4xl extrabold for `emphasis="extrabold"`, else 3xl bold.
* @returns The class string.
*/
titleClasses(): string {
return this.cm().cn(
this.cm().textSize(this.emphasis === 'extrabold' ? '4xl' : '3xl'),
this.cm().fontWeight(this.emphasis === 'extrabold' ? 'extrabold' : 'bold'),
)
}
/**
* The subtitle paragraph's class (`cm.textSize('base')`).
* @returns The class string.
*/
subtitleClasses(): string {
return this.cm().textSize('base')
}
/**
* The meta row's class (`cm.flex({ align: 'center', gap: 'sm', wrap: 'wrap' })`).
* @returns The class string.
*/
metaClasses(): string {
return this.cm().flex({ align: 'center', gap: 'sm', wrap: 'wrap' })
}
/**
* Withholds the optional regions React omits, and restores the ones with
* content.
*
* @param hasContent - Reads whether a slot has content.
*/
private sync(hasContent: SlotReader): void {
const subtitle = this.subtitleEl?.nativeElement
setElementPresent(subtitle, hasContent(subtitle))
const actions = this.actionsEl?.nativeElement
setElementPresent(actions, hasContent(actions))
const meta = this.metaEl?.nativeElement
setElementPresent(meta, hasContent(meta))
}
}
Injection Notes
Requirements
Peer dependencies:
@angular/common^22.0.0@angular/core^22.0.0@angular/platform-browser^22.0.0@molecule/app-angular^3.13.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-angular^1.1.0
Runtime Dependencies
@angular/common@angular/core@angular/platform-browser@molecule/app-angular@molecule/app-ui@molecule/app-ui-angular
Not to be confused with @molecule/app-ui-angular's own <PageHeader>
(props: title/description/actions/breadcrumbs): THIS PageHeader
takes subtitle (not description) and adds icon, meta, and
emphasis. Import from the package that matches the props you pass.
Styling resolves via getClassMap() from @molecule/app-ui, so a ClassMap
bond (e.g. @molecule/app-ui-tailwind) must be wired before render.