PageLayout
CustomerDashboardPageLayout is the standard shell for a customer-dashboard page. It renders the
page title, an optional description, top actions, a search bar, tabs and filters, and hosts your
page content below.
Prefer this layout for any new customer-dashboard page so titles, spacing and controls stay consistent across the dashboard.
- Import:
import { CustomerDashboardPageLayout } from "@alan-eu/global-customer-dashboard/shared-layout/CustomerDashboardPageLayout"; - Source:
frontend/shared/global-customer-dashboard/shared-layout/CustomerDashboardPageLayout.tsx - Storybook: browse the stories
Basic usage
Configure the page declaratively through props, then render your content as children:
<CustomerDashboardPageLayout
title="Members"
description="Manage your team members and track onboarding progress."
topActions={[{ title: "Invite employees", type: "navigate", toRoute: "invite-employees" }]}
search={{ placeholder: "Search members...", debounceTime: 300 }}
>
<MembersList />
</CustomerDashboardPageLayout>
Props
| Prop | Type | Description |
|---|---|---|
title | string | (() => string) | Page title. Pass a function only for module-level declarations where i18n isn't ready yet. |
description | string | Short description shown below the title. Takes precedence over the description slot. |
topActions | TopAction[] | Primary actions rendered as buttons in the header. Each navigates to toRoute. |
search | Search | Enables the search bar. Read the current term from the useSearch() hook in your content. |
tabs | TabConfig[] | Enables a tabbed layout. Pair with <TabSwitch> in the children to render each tab's content. |
defaultTab | string | Tab key active by default. Falls back to the first tab. Persisted in the selectedSubview URL param. |
filterGroups | Record<string, FilterConfig[]> | Per-tab filter configuration. Read the current filters from the useFilters() hook. |
Search
Pass a search prop to render the search bar, then read the debounced term from useSearch():
const MembersList = () => {
const { searchTerm } = useSearch();
return <List query={searchTerm} />;
};
Tabs
Declare tabs via the tabs prop and render their content with <TabSwitch>:
<CustomerDashboardPageLayout
title="Members"
tabs={[
{ key: "active", label: "Active members" },
{ key: "archived", label: "Archived members" },
]}
>
<TabSwitch tabs={{ active: <ActiveMembers />, archived: <ArchivedMembers /> }} />
</CustomerDashboardPageLayout>
Alternatively, declare tabs deeper in the tree via the tabs slot with
<CustomerDashboardPageLayout.SlotContent name="tabs"> and <CustomerDashboardPageLayout.Tabs />.
Slots
For cases the declarative props don't cover, fill named slots from anywhere in the subtree. Prefer the declarative props whenever possible to stay within the layout's guardrails.
<CustomerDashboardPageLayout title="Employees">
<CustomerDashboardPageLayout.SlotContent name="actions">
<Button size="sm" variant="secondary">
Custom action
</Button>
</CustomerDashboardPageLayout.SlotContent>
<EmployeesContent />
</CustomerDashboardPageLayout>
Available slots: actions, description, tabs.