App shell and page header
Build the app shell with AppShell (menu per role, account, sign-out) and the top of each page with PageContainer (title, status, summary, key number, decision buttons).
The shell is what users see on every page after sign-in: logo, menu, account. The page header says where they are and what they can do. Both are props of Pro components, with no CSS of your own.
// App shell: ProLayout mix + 3-level grouped menu + 9-dot app launcher + header icons + avatar.
// In a real app: menuItemRender uses useNavigate()/<Link>, location = useLocation().
import { useState } from "react";
import { PageContainer, ProCard, ProLayout } from "@ant-design/pro-components";
import { Dropdown, Typography, theme } from "antd";
import {
AppstoreOutlined, AuditOutlined, BarChartOutlined, FileTextOutlined, GithubFilled,
InfoCircleFilled, LogoutOutlined, QuestionCircleFilled, ShoppingOutlined, TeamOutlined,
} from "@ant-design/icons";
const route = {
path: "/",
children: [
{
path: "/ops", name: "Operations", icon: <AppstoreOutlined />,
children: [
{ path: "/ops/orders", name: "Orders", icon: <ShoppingOutlined />, children: [
{ path: "/ops/orders/all", name: "All orders" },
{ path: "/ops/orders/pending", name: "To process" },
] },
{ path: "/ops/requests", name: "Purchase requests", icon: <FileTextOutlined />, children: [
{ path: "/ops/requests/mine", name: "Mine" },
{ path: "/ops/requests/inbox", name: "Needs my approval" },
] },
],
},
{
path: "/report", name: "Reports", icon: <BarChartOutlined />,
children: [
{ path: "/report/sales", name: "Sales", icon: <BarChartOutlined />, children: [
{ path: "/report/sales/month", name: "By month" },
] },
],
},
],
};
const appList = [
{ title: "Internal", desc: "Company apps", children: [
{ title: "CRM", desc: "Customers & deals", icon: <TeamOutlined />, url: "#crm" },
{ title: "Inventory", desc: "Stock & shipments", icon: <ShoppingOutlined />, url: "#inventory" },
] },
{ title: "Tools", desc: "Shared", children: [
{ title: "Purchase approvals", desc: "Requests & approvals", icon: <AuditOutlined />, url: "#approvals" },
] },
];
export default function Page() {
const { token } = theme.useToken();
const [pathname, setPathname] = useState("/ops/orders/all");
return (
<div style={{ height: "100vh" }}>
<ProLayout
title="Acme Admin"
logo={<AuditOutlined style={{ fontSize: 22, color: token.colorPrimary }} />}
layout="mix"
splitMenus
siderMenuType="group"
menu={{ collapsedShowGroupTitle: true, locale: false }}
fixSiderbar
route={route}
location={{ pathname }}
menuItemRender={(item, dom) => <a onClick={() => item.path && setPathname(item.path)}>{dom}</a>}
appList={appList}
bgLayoutImgList={[
{ src: "https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png", left: 85, bottom: 100, height: "303px" },
{ src: "https://img.alicdn.com/imgextra/i3/O1CN018NxReL1shX85Yz6Cx_!!6000000005798-2-tps-884-496.png", bottom: 0, left: 0, width: "331px" },
]}
actionsRender={(p) => (p.isMobile ? [] : [<InfoCircleFilled key="i" />, <QuestionCircleFilled key="q" />, <GithubFilled key="g" />])}
avatarProps={{
size: "small",
title: "Hannah Reed",
src: "https://manh.run/avatars/06.svg",
render: (_, dom) => <Dropdown menu={{ items: [{ key: "out", icon: <LogoutOutlined />, label: "Sign out" }] }}>{dom}</Dropdown>,
}}
menuFooterRender={(p) => (p?.collapsed ? undefined : <div style={{ textAlign: "center", paddingBlockStart: 12, color: token.colorTextTertiary }}>v1.0 · Acme</div>)}
>
<PageContainer subTitle={pathname}>
<ProCard>
<Typography.Paragraph>
Click the menu items (top: level-1 groups; left: level-2 group titles + level-3 items) and the 9-dot button next to the logo.
</Typography.Paragraph>
</ProCard>
</PageContainer>
</ProLayout>
</div>
);
}
Build the "ProLayout app shell" screen for my app following the Manh UI playbook (framework_docs("pro")): App shell: ProLayout mix + 3-level grouped menu + 9-dot app launcher + header icons + avatar. Data comes from the app's API through useApiClient(); labels and fields follow my spec.Where it sits in the app tree
The shell is AppShell from manh/shell, placed in app/layout.tsx. Sign-in and sign-up pages render without it.
app/
├── layout.tsx AppShell: menu, roles, signed-in user
├── theme.tsx primary color, radius, dark mode
├── login/page.tsx public page, no shell
└── requests/page.tsx page inside the shell, starts with PageContainerBuild the shell with AppShell
app/layout.tsx only says what goes in the shell. Menu per role, sign-out, Vietnamese locale and theme come with AppShell.
import { AppShell } from "manh/shell";
import { DashboardOutlined, FileTextOutlined, TeamOutlined } from "@ant-design/icons";
import { getUser, signOut } from "app/hooks";
import { APP_THEME } from "app/theme";
const MENU = [
{ path: "/", name: "Overview", icon: <DashboardOutlined /> },
{ path: "/requests", name: "Requests", icon: <FileTextOutlined /> },
{ path: "/users", name: "Users", icon: <TeamOutlined />, roles: ["admin"] },
];
export default function RootLayout() {
return (
<AppShell appName="Purchase approvals" menu={MENU} roleLabels={{ admin: "Admin", staff: "Staff" }}
user={getUser()} onSignOut={signOut} theme={APP_THEME} />
);
}roleshides an item from users without that role. A menu group is{ name, icon, children: [...] }.count: () => numbershows the work waiting next to a menu item, refreshed on every page change.- A detail page like
/requests/12still highlights Requests. Signed-out users are sent to/login.
Skip the shell on public pages
/login and /register have no shell. List other public pages, such as a booking form or an order lookup, in publicPaths. Their API sets export const access = "public".
const PUBLIC_PATHS = ["/login", "/register", "/booking"];
<AppShell /* … */ publicPaths={PUBLIC_PATHS} />For a whole public branch of paths, use isPublic={(p) => p.startsWith("/lookup")}.
Build your own shell with ProLayout
For a first-level menu in the top bar or a nine-dot app launcher, replace AppShell with your own ProLayout.
<ProLayout
layout="mix" splitMenus // level 1 in the top bar, levels 2–3 on the left
siderMenuType="group" // level 2 becomes group titles, level 3 items
menu={{ collapsedShowGroupTitle: true, locale: false }}
route={{ path: "/", children: [
{ path: "/ops", name: "Operations", icon: <AppstoreOutlined />, children: [
{ path: "/ops/orders", name: "Orders", children: [{ path: "/ops/orders/all", name: "All orders" }] },
] },
] }}
appList={[ // nine-dot button next to the logo
{ title: "Internal", desc: "Company apps", children: [
{ title: "CRM", desc: "Customers and deals", icon: <TeamOutlined />, url: "https://crm.example.com", target: "_blank" },
] },
]}
menuFooterRender={(p) => (p?.collapsed ? undefined : <div>v1.0</div>)}
location={{ pathname }}
menuItemRender={(item, dom) => <a onClick={() => item.path && nav(item.path)}>{dom}</a>}
/>-
menuItemRenderandlocationare required: without them, menu clicks don’t navigate and no item is highlighted. -
appList: items withchildrenrender as titled groups. When every item hasdesc, the launcher shows large cards; otherwise it shows a compact icon grid. -
splitMenusonly makes sense withlayout="mix". The active top-bar item comes fromlocation.pathname. -
breakpoint(defaultlg) collapses the left menu automatically; to control it yourself, usecollapsed+onCollapse.
Page header with PageContainer
Every page inside the shell starts with PageContainer. Put each element in its own slot:
<PageContainer
header={{
title: r.title,
breadcrumb: { items: [{ title: <a onClick={() => nav("/requests")}>Requests</a> }, { title: `#${r.id}` }] },
tags: <Tag color="processing">Pending</Tag>,
extra: <FlowActions flow={RequestFlow} record={r} labels={RequestStatus} move={move} onDone={refresh} />,
}}
content={<ProDescriptions column={{ xs: 1, sm: 2, lg: 4 }}>{/* 3–4 key facts */}</ProDescriptions>}
extraContent={<Statistic title="Requested amount" value={vnd(r.amount)} />} // the one number that matters
>
{/* … */}
</PageContainer>contentis the summary strip under the title;extraContentholds 1–3 right-aligned numbers.header.extraholds the status buttons.FlowActionsshows only the moves the signed-in user may make (see Detail pages).- Pages with several aspects (info, history, related):
tabList+tabActiveKey+onTabChange. - Dashboards:
titleis a greeting,subTitleis the to-do count (“2 requests are waiting for your approval”), andextraholds one primary button.
Good to know
- Don’t use
onBackonPageContainer, because the page crashes. Useheader.breadcrumb. - Don’t hand-build
Layout.Sider+Menu, don’t override.ant-pro-*classes, and don’t shipSettingDrawer. - Shell colors come from
app/theme.tsx. In your own shell, use theProLayouttoken, not typed color codes.
Next steps
- List pages — the page the Requests menu opens.
- Detail pages — a full
PageContainerwith approval buttons. - Pages and layouts —
app/layout.tsx, pages and dynamic paths.