ProLayout API
ProLayout provides a standard layout for admin interfaces with sidebar navigation, header, and content areas.
ProLayoutProps
title
string | React.ReactNode
default:"Ant Design Pro"
Site title displayed in the sidebar header.
Logo displayed in the sidebar header.
Loading state for the layout.
layout
'side' | 'top' | 'mix'
default:"side"
Navigation layout type.
side - Sidebar navigation
top - Top navigation
mix - Mixed navigation (sidebar + top)
navTheme
'light' | 'dark' | 'realDark'
default:"dark"
Navigation theme.
light - Light theme
dark - Dark sidebar with light header
realDark - Dark sidebar and header
contentWidth
'Fluid' | 'Fixed'
default:"Fluid"
Content area width.
Fluid - Full width
Fixed - Fixed width (1200px)
Fix header at the top when scrolling.
Fix sidebar when scrolling.
Controlled sidebar collapsed state.
Default sidebar collapsed state.
Callback when sidebar collapse state changes.(collapsed: boolean) => void
Custom render for collapse button.(collapsed: boolean) => React.ReactNode
Set to false to hide.
Breakpoint for responsive behavior.type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'
Whether the layout is in mobile mode.
Custom render for menu header (logo area).(logo: React.ReactNode, title: React.ReactNode, props: ProLayoutProps) => React.ReactNode
Set to false to hide.
Custom render for menu footer.(props: ProLayoutProps) => React.ReactNode
Custom render for extra content above menu items.(props: ProLayoutProps) => React.ReactNode
Custom render for entire menu content.(props: ProLayoutProps, defaultDom: React.ReactNode) => React.ReactNode
Custom render for menu items.(itemProps: MenuDataItem, defaultDom: React.ReactNode, props: ProLayoutProps) => React.ReactNode
Custom render for submenu items.(itemProps: MenuDataItem, defaultDom: React.ReactNode) => React.ReactNode
Custom render for header.(props: ProLayoutProps, defaultDom: React.ReactNode) => React.ReactNode
Set to false to hide.
Custom render for header title.(logo: React.ReactNode, title: React.ReactNode, props: ProLayoutProps) => React.ReactNode
Custom render for header content area.(props: ProLayoutProps) => React.ReactNode
Custom render for right side of header.(props: ProLayoutProps) => React.ReactNode
Custom render for footer.(props: ProLayoutProps) => React.ReactNode
Set to false to hide.
Custom render for breadcrumb.(routers: Route[]) => Route[]
Custom render for page title (shown in browser tab).(props: ProLayoutProps, defaultPageTitle?: string, info?: { title: string; id: string; pageName: string }) => string
Callback when page route changes.(location?: Location) => void
Route configuration for menu generation.type Route = {
path?: string;
name?: string;
icon?: React.ReactNode;
children?: Route[];
hideInMenu?: boolean;
hideChildrenInMenu?: boolean;
[key: string]: any;
}
Menu configuration.Show MenuConfig Properties
locale?: boolean - Enable internationalization for menu
defaultOpenAll?: boolean - Open all submenus by default
loading?: boolean - Menu loading state
onLoadingChange?: (loading: boolean) => void - Loading change callback
request?: (params: any, defaultMenuData: MenuDataItem[]) => Promise<MenuDataItem[]> - Load menu from remote
type?: 'sub' | 'group' - Submenu type
autoClose?: boolean - Auto close other menus when opening one
Transform menu data before rendering.(menuData: MenuDataItem[]) => MenuDataItem[]
Current location for menu selection.
Configuration for individual menu items.
Hide child items in menu.
Unique key for the menu item.
Internationalization key for the menu item.
Link target (e.g., _blank).
Parent keys to select when this item is active.
Hide self and promote children to same level.
Tooltip for the menu item.
Styling
token
DeepPartial<ProTokenType>
Custom design tokens for theming.
bgLayoutImgList
{ src: string; left?: number; bottom?: number; height?: string }[]
Background images for the layout.
Width of the sidebar when expanded.
Hide sidebar when menu is empty.
Open all submenus by default (deprecated, use menu.defaultOpenAll).
Disable mobile responsive behavior.
Inline styles for content area.
ErrorBoundary
React.ComponentType | false
Error boundary component.
Page Container
Watermark configuration for the page.
Controlled open submenu keys.
Controlled selected menu keys.
Callback when submenu open state changes.(openKeys: string[]) => void
Callback when menu header (logo area) is clicked.(e: React.MouseEvent) => void
Internationalization formatter.(message: { id: string; defaultMessage?: string }) => string
Links to display at the bottom of the sidebar.
Split menus for mix layout.
Usage Examples
Basic Usage
Top Navigation
import { ProLayout } from '@ant-design/pro-components';
import { Link } from 'react-router-dom';
export default () => {
return (
<ProLayout
title="My App"
logo={<img src="/logo.svg" />}
route={{
routes: [
{
path: '/dashboard',
name: 'Dashboard',
icon: <DashboardOutlined />,
},
{
path: '/users',
name: 'Users',
icon: <UserOutlined />,
},
],
}}
menuItemRender={(item, dom) => (
<Link to={item.path || '/'}>{dom}</Link>
)}
>
{/* Page content */}
</ProLayout>
);
};
<ProLayout
layout="top"
navTheme="light"
contentWidth="Fixed"
route={{
routes: menuData,
}}
>
{children}
</ProLayout>
Layout Sub-Components
ProLayout exports several sub-components for building custom layouts.
PageContainer
Container for page content with breadcrumb and page header.
import { PageContainer } from '@ant-design/pro-components';
<PageContainer
title="Page Title"
subTitle="Page subtitle"
extra={[<Button key="1">Action</Button>]}
breadcrumb={{
items: [
{ title: 'Home', path: '/' },
{ title: 'Current' },
],
}}
>
{/* Page content */}
</PageContainer>
Props:
Extra content in the page header (usually action buttons)
Loading state for the page
Fixed footer toolbar for form actions.
import { FooterToolbar } from '@ant-design/pro-components';
import { Button } from 'antd';
<FooterToolbar
extra={<span>Extra info</span>}
>
<Button>Cancel</Button>
<Button type="primary">Submit</Button>
</FooterToolbar>
Props:
Extra content on the left side
renderContent
(props, dom) => React.ReactNode
Custom render function for toolbar content
GridContent
Responsive grid content container that respects layout contentWidth.
import { GridContent } from '@ant-design/pro-components';
<GridContent>
{/* Content auto-adjusts based on layout contentWidth */}
</GridContent>
PageLoading
Loading component for page transitions.
import { PageLoading } from '@ant-design/pro-components';
<PageLoading />
SettingDrawer
Development-only drawer for testing different layout configurations.
import { SettingDrawer } from '@ant-design/pro-components';
const [settings, setSettings] = useState({});
<SettingDrawer
settings={settings}
onSettingChange={(changeSetting) => {
setSettings(changeSetting);
}}
/>
SettingDrawer should only be used in development. Do not include it in production builds.
Default footer component with links and copyright.
import { DefaultFooter } from '@ant-design/pro-components';
<DefaultFooter
copyright="2024 Ant Design"
links={[
{
key: 'github',
title: 'GitHub',
href: 'https://github.com/ant-design/pro-components',
blankTarget: true,
},
]}
/>
ProBreadcrumb
Breadcrumb component that integrates with routing.
import { ProBreadcrumb } from '@ant-design/pro-components';
<ProBreadcrumb />