Repository navigation
PageTitle
PageTitle is the shared page-header component for routed screens. It keeps the page's visible heading, breadcrumb trail, subtitle, inline header actions, and page-title context synchronized in one place.
Use PageTitle when a page needs a single, consistent <h1> with optional breadcrumb navigation and shell-aware title synchronization. The component centralizes the page-header pattern so each route does not reimplement heading layout or page-title context updates.
- Source:
frontend/src/components/core/PageTitle/index.tsx - Tests:
frontend/src/components/core/PageTitle/index.unit.test.tsx
| Name | Type | Required | Description |
|---|---|---|---|
title |
string |
Yes | Visible page heading rendered as the <h1>. |
subtitle |
string |
No | Optional supporting text rendered through Subtitle. |
experimental |
boolean |
No | When true, renders the page-scoped UnderConstructionTag. |
children |
React.ReactNode |
No | Optional inline content rendered beside the title, such as actions or status tags. |
breadCrumbs |
BreadCrumbType[] |
No | Ordered breadcrumb entries used for visible navigation and for the shared page-title context value. |
type BreadCrumbType = {
name: string;
path: string;
};- Renders inside a Carbon
Columnwithsm={4},md={8}, andlg={16}. - Uses TanStack Router's
useNavigate()for breadcrumb navigation. - Pushes a title into
usePageTitle()whenevertitleorbreadCrumbschange. - Derives the shared page-title context from joined breadcrumb names when breadcrumbs exist; otherwise it falls back to
title. - Renders the title row in this order:
<h1>,children, thenUnderConstructionTagwhenexperimentalis true.
import PageTitle from '@/components/core/PageTitle';
<PageTitle title="Dashboard" subtitle="Overview of your data" />;import { Button } from '@carbon/react';
import PageTitle from '@/components/core/PageTitle';
<PageTitle
title="Waste Search"
subtitle="Browse and refine results"
experimental
breadCrumbs={[
{ name: 'Home', path: '/' },
{ name: 'Search', path: '/search' },
]}
>
<Button kind="ghost" size="sm">
Export
</Button>
</PageTitle>;Current unit coverage verifies:
- title and subtitle rendering
- breadcrumb rendering and click handling
- experimental tag rendering
- child content rendering
The tests render PageTitle under both RouterProvider and PageTitleProvider, matching the component's runtime dependencies.
- Breadcrumb
pathvalues must be valid TanStack Routertotargets. -
PageTitledepends onPageTitleProvider; without it,usePageTitle()will fail. - The shared page-title context uses breadcrumb names only. Subtitle text is not part of the derived title.
-
codes/frontend/Components.md— catalog entry points to this page. -
development/conventions/Frontend Structure Guidelines.md— referencesPageTitleas the standard route-level<h1>provider.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository