Layout

Handling the overall layout of a page.

import { NzLayoutModule } from 'ng-zorro-antd/layout';

Specification#

Size#

The first level navigation is inclined left near a logo, and the secondary menu is inclined right.

  • Top Navigation (almost systems): the height of the first level navigation 64px, the second level navigation 48px.
  • Top Navigation(contents page): the height of the first level navigation 80px, the second level navigation 56px.
  • Calculation formula of a top navigation: 48+8n.
  • Calculation formula of an aside navigation: 200+8n.

Interaction rules#

  • The first level navigation and the last level navigation should be distincted by visualization;
  • The current item should have the highest priority of visualization;
  • When the current navigation item is collapsed, the style of the current navigation item will be applied to its parent level;
  • The left side navigation bar has support for both the accordion and expanding styles, you can choose the one that fits your case best.

Visualization rules#

Style of a navigation should conform to the its level.

  • Emphasis by colorblock

    When background color is a deep color, you can use this pattern for the parent level navigation item of current page.

  • The highlight match stick

    When background color is a light color, you can use this pattern for the current page navigation item, we recommed using it for the last item of the navigation path.

  • Hightlighted font

    From the visualization aspect, hightlighted font is stronger than colorblock, this pattern is often used for the parent level of the current item.

  • Enlarge the size of the font

    12px14px is a standard font size of navigations,14px is used for the first and the second level of the navigation. You can choose a approprigate font size in terms of the level of your navigation.

Component Overview#

  • nz-layout: The layout wrapper, in which nz-headernz-sidernz-contentnz-footer or nz-layout itself can be nested, and can be placed in any parent container.
  • nz-header: The top layout with default style, in which any element can be nested, and must be placed in nz-layout.
  • nz-sider: The sidebar with default style and basic functions, in which any element can be nested, and must be placed in nz-layout.
  • nz-content: The content layout with default style, in which any element can be nested, and must be placed in nz-layout.
  • nz-footer: The bottom layout with default style, in which any element can be nested, and must be placed in nz-layout.

Based on flex layout, please pay attention to the compatibility.

Examples

HeaderContentFooterHeader
Sider
Content
Footer
HeaderContent
Sider
Footer
Sider
HeaderContentFooter

Classic page layouts.

expand codeexpand code
Loading...
  • nav 1
  • nav 2
  • nav 3
Home/List/App/
Content
Ant Design ©2020 Implement By Angular

The most basic "header-content-footer" layout.

Generally, the mainnav is placed at the top of the page, and includes the logo, the first level navigation, and the secondary menu (users, settings, notifications) from left to right in it. We always put contents in a fixed size navigation (eg: 1200px), the layout of the whole page is stable, it's not affected by viewing area.

Top-bottom structure is conform with the top-bottom viewing habit, it's a classical navigation pattern of websites. This pattern demonstrates efficiency in the main workarea, while using some vertical space. And because the horizontal space of the navigation is limited, this pattern is not suitable for cases when the first level navigation contains many elements or links

expand codeexpand code
Loading...
  • nav 1
  • nav 2
  • nav 3
  • subnav 1
    • option1
    • option2
    • option3
    • option4
  • subnav 2
    • option5
    • option6
    • option7
    • option8
  • subnav 3
    • option9
    • option10
    • option11
    • option12
Home/List/App/Content

Both the top navigation and the sidebar, commonly used in application site.

expand codeexpand code
Loading...
  • nav 1
  • nav 2
  • nav 3
Home/List/App/
  • subnav 1
    • option1
    • option2
    • option3
    • option4
  • subnav 2
    • option5
    • option6
    • option7
    • option8
  • subnav 3
    • option9
    • option10
    • option11
    • option12
Content
Ant Design ©2020 Implement By Angular

Both the top navigation and the sidebar, commonly used in documentation site.

expand codeexpand code
Loading...

Two-columns layout. The sider menu can be collapsed when horizontal space is limited.

Generally, the mainnav is placed on the left side of the page, and the secondary menu is placed on the top of the working area. Contents will adapt the layout to the viewing area to improve the horizontal space usage, while the layout of the whole page is not stable.

The level of the aisde navigation is scalable. The first, second, and third level navigations could be present more fluently and relevantly, and aside navigation can be fixed, allowing the user to quickly switch and spot the current position, improving the user experience. However, this navigation occupies some horizontal space of the contents

expand codeexpand code
Loading...
  • User
    • Tom
    • Bill
    • Alex
  • Team
    • Team 1
    • Team 2
  • File
User/Bill/
Bill is a cat.
Ant Design ©2020 Implement By Angular

If you want to use a customized trigger, you can hide the default one by setting [nzTrigger]="null".

expand codeexpand code
Loading...

Layout.Sider supports responsive layout.

Note: You can get a responsive layout by setting nzBreakpoint, the nz-sider will collapse to the width of nzCollapsedWidth when window width is below the nzBreakpoint. And a special trigger will appear if the nzCollapsedWidth is set to 0.

expand codeexpand code
Loading...

Fixed Header is generally used to fix the top navigation to facilitate page switching.

expand codeexpand code
Loading...

When dealing with long content, a fixed sider can provide a better user experience.

expand codeexpand code
Loading...

API#

<nz-layout>
  <nz-header>header</nz-header>
  <nz-layout>
    <nz-sider>left sidebar</nz-sider>
    <nz-content>main content</nz-content>
    <nz-sider>right sidebar</nz-sider>
  </nz-layout>
  <nz-footer>footer</nz-footer>
</nz-layout>

nz-sider#

The sidebar.

PropertyDescriptionTypeDefault
[nzBreakpoint]breakpoints of the responsive layout'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'-
[nzCollapsedWidth]width of the collapsed sidebar, by setting to 0 a special trigger will appearnumber64
[nzCollapsible]whether can be collapsedbooleanfalse
[nzCollapsed]the collapsed status can be double bindingbooleanfalse
[nzReverseArrow]reverse direction of arrow, for a sider that expands from the rightbooleanfalse
[nzTrigger]specify the customized trigger, set to null to hide the triggerstring | TemplateRef<void>-
[nzZeroTrigger]specify the customized trigger when nzCollapsedWidth setting to 0TemplateRef<void>-
[nzWidth]width of the sidebarnumber | string200
[nzTheme]color theme of the sidebar'light' | 'dark'dark
(nzCollapsedChange)the callback functionEventEmitter<boolean>-

breakpoint width#

{
  xs: '575px',
  sm: '576px',
  md: '768px',
  lg: '992px',
  xl: '1200px',
  xxl: '1600px'
}