• English
  • PageContainer - Page Container

    PageContainer is a page container component that provides a unified page layout structure. It includes standardized page elements such as page title, breadcrumb navigation, and page operation area, allowing you to quickly build pages with consistent layouts.

    • Automatically handles page title and breadcrumb navigation
    • Supports page-level operation buttons and toolbars
    • Provides standardized page layout structure
    • Supports advanced features like watermarks and loading states

    When to Use

    • When you need unified page title and breadcrumb navigation
    • When you need page-level operation buttons
    • When you need standardized page layout
    • When you need page-level loading states
    • When you need page watermark functionality

    Code Demo

    Basic Usage
    import { EllipsisOutlined } from '@ant-design/icons';
    import { PageContainer, ProCard } from '@ant-design/pro-components';
    import { Button, Dropdown, message } from 'antd';
    
    const Demo = () => (
      <div
        style={{
          background: '#F5F7FA',
        }}
      >
        <PageContainer
          onBack={()=>{}}
          header={{
            title: 'Page Title',
            ghost: true,
            breadcrumb: {
              items: [
                {
                  path: '',
                  title: 'Primary page',
                },
                {
                  path: '',
                  title: 'Secondary page',
                },
                {
                  path: '',
                  title: 'Current page',
                },
              ],
            },
            extra: [
              <Button key="1">Secondary button</Button>,
              <Button key="2">Secondary button</Button>,
              <Button key="3" type="primary">
                Primary button
              </Button>,
              <Dropdown
                key="dropdown"
                trigger={['click']}
                menu={{
                  items: [
                    {
                      label: 'Dropdown menu',
                      key: '1',
                    },
                    {
                      label: 'Dropdown menu 2',
                      key: '2',
                    },
                    {
                      label: 'Dropdown menu 3',
                      key: '3',
                    },
                  ],
                }}
              >
                <Button key="4" style={{ padding: '0 8px' }}>
                  <EllipsisOutlined />
                </Button>
              </Dropdown>,
            ],
          }}
          tabBarExtraContent="Test tabBarExtraContent"
          tabList={[
            {
              tab: 'Basic information',
              key: 'base',
              closable: false,
            },
            {
              tab: 'Detailed information',
              key: 'info',
            },
          ]}
          tabProps={{
            type: 'editable-card',
            hideAdd: true,
            onEdit: (_targetKey, action) => {
              message.info(`tab ${action}`);
            },
          }}
          footer={[
            <Button key="3">Reset</Button>,
            <Button key="2" type="primary">
              Submit
            </Button>,
          ]}
        >
          <ProCard direction="column" ghost gutter={[0, 16]}>
            <ProCard style={{ height: 200 }} />
            <ProCard gutter={16} ghost style={{ height: 200 }}>
              <ProCard colSpan={16} />
              <ProCard colSpan={8} />
            </ProCard>
          </ProCard>
        </PageContainer>
      </div>
    );
    
    export default () => (
      <div style={{ padding: 24 }}>
        <Demo />
      </div>
    );
    
    Fixed Header
    import { PageContainer, ProCard } from '@ant-design/pro-components';
    
    const Demo = () => (
      <div
        style={{
          background: '#F5F7FA',
        }}
      >
        <PageContainer
          fixedHeader
          header={{
            title: 'Page Title',
            breadcrumb: {
              items: [
                {
                  path: '',
                  title: 'Primary page',
                },
                {
                  path: '',
                  title: 'Secondary page',
                },
                {
                  path: '',
                  title: 'Current page',
                },
              ],
            },
          }}
          tabList={[
            {
              tab: 'Selected',
              key: '1',
            },
            {
              tab: 'Clickable',
              key: '2',
            },
            {
              tab: 'Disabled',
              key: '3',
              disabled: true,
            },
          ]}
        >
          <ProCard direction="column" ghost gutter={[0, 16]}>
            <ProCard style={{ height: 200 }} />
            <ProCard gutter={16} ghost>
              <ProCard colSpan={16} style={{ height: 200 }} />
              <ProCard colSpan={8} style={{ height: 200 }} />
            </ProCard>
            <ProCard gutter={16} ghost>
              <ProCard colSpan={8} style={{ height: 200 }} />
              <ProCard colSpan={16} style={{ height: 200 }} />
            </ProCard>
          </ProCard>
        </PageContainer>
      </div>
    );
    
    export default () => (
      <div style={{ padding: 24 }}>
        <Demo />
      </div>
    );
    
    Page Title
    Creator逄一
    Associated form421421
    Creation Date2017-01-10
    Document remarks浙江省杭州市西湖区工专路
    Hide Breadcrumb
    import { PageContainer, ProCard } from '@ant-design/pro-components';
    import { Descriptions } from 'antd';
    
    const Demo = () => (
      <div
        style={{
          background: '#F5F7FA',
        }}
      >
        <PageContainer
          ghost
          header={{
            title: 'Page Title',
            breadcrumb: {},
          }}
          content={
            <Descriptions column={2} style={{ marginBlockEnd: -16 }}>
              <Descriptions.Item label="Creator">逄一</Descriptions.Item>
              <Descriptions.Item label="Associated form">
                <a>421421</a>
              </Descriptions.Item>
              <Descriptions.Item label="Creation Date">
                2017-01-10
              </Descriptions.Item>
              <Descriptions.Item label="Document remarks">
                浙江省杭州市西湖区工专路
              </Descriptions.Item>
            </Descriptions>
          }
        >
          <ProCard direction="column" ghost gutter={[0, 16]}>
            <ProCard style={{ height: 200 }} />
            <ProCard gutter={16} ghost style={{ height: 200 }}>
              <ProCard colSpan={16} />
              <ProCard colSpan={8} />
            </ProCard>
          </ProCard>
        </PageContainer>
      </div>
    );
    
    export default () => (
      <div style={{ padding: 24 }}>
        <Demo />
      </div>
    );
    

    API

    PageContainer

    ParameterDescriptionTypeDefault
    titlePage title, set false to hideReactNode | false-
    subTitlePage subtitleReactNode-
    extraPage operation areaReactNode-
    extraContentExtra content beside the operation areaReactNode-
    contentPage contentReactNode-
    footerFooter toolbar (items aligned right)ReactNode[]-
    loadingLoading stateboolean | SpinProps | ReactNodefalse
    headerHeader configurationPartial<PageHeaderProps> & { children?: ReactNode }-
    pageHeaderRenderCustom pageHeader, return false to hide(props: PageContainerProps) => ReactNode | false-
    affixPropsAffix configuration, same as antdOmit<AffixProps, 'children'>-
    breadcrumbBreadcrumb configurationBreadcrumbProps-
    breadcrumbRenderCustom breadcrumb rendering, return false to hidePageHeaderProps['breadcrumbRender'] | false-
    waterMarkPropsWatermark configurationWatermarkProps-
    tokenCustom tokenpageContainerToken-
    stylishStyle configurationGenerateStyle<PageContainerToken>-
    footerStylishFooter style configurationGenerateStyle<PageContainerToken>-
    footerToolBarPropsFooter toolbar configurationFooterToolbarProps-
    tabListTab configuration (passed to PageHeader tabs)(TabPaneProps & { key?: React.Key })[]-
    tabActiveKeyCurrently active tabTabsProps['activeKey']-
    onTabChangeTab change callbackTabsProps['onChange']-
    tabBarExtraContentExtra area on the tab barTabsProps['tabBarExtraContent']-
    tabPropsOther tabs configsTabsProps-
    fixedHeaderFix PageHeader to the top of the pageboolean-
    childrenChildrenReactNode-

    PageHeaderProps

    ParameterDescriptionTypeDefault
    titleTitleReactNode-
    subTitleSubtitleReactNode-
    extraOperation areaReactNode-
    breadcrumbBreadcrumbBreadcrumbProps-
    tagsTagsTagProps[]-
    avatarAvatarAvatarProps-
    backIconBack iconReactNode-
    onBackBack event() => void-

    Design Guidelines

    PageContainer provides standardized page layout, ensuring consistency in page structure across the entire application. It follows Ant Design design guidelines, providing a consistent user experience.