Layout
가져오기import{ Layout }from"antd"; |
가져오기import{ Layout }from"antd"; |
The first level navigation is left aligned near a logo, and the secondary menu is right aligned.
64px
, and the second level navigation is 48px
.80px
, and the second level navigation is 56px
.48+8n
.200+8n
.Style of a navigation should conform to its level.
Emphasis by colorblock
When the background color is a deep color, you can use this pattern for the parent level navigation item of the current page.
The highlight match stick
When the background color is a light color, you can use this pattern for the current page navigation item; we recommend using it for the last item of the navigation path.
Highlighted font
From the visualization aspect, a highlighted font is stronger than colorblock; this pattern is often used for the parent level of the current item.
Enlarge the size of the font
12px
, 14px
is a standard font size of navigation's, 14px
is used for the first and the second level of the navigation. You can choose an appropriate font size regarding the level of your navigation.
Layout
: The layout wrapper, in which Header
Sider
Content
Footer
or Layout
itself can be nested, and can be placed in any parent container.Header
: The top layout with the default style, in which any element can be nested, and must be placed in Layout
.Sider
: The sidebar with default style and basic functions, in which any element can be nested, and must be placed in Layout
.Content
: The content layout with the default style, in which any element can be nested, and must be placed in Layout
.Footer
: The bottom layout with the default style, in which any element can be nested, and must be placed in Layout
.Based on
flex layout
, please pay attention to the compatibility.
<Layout><Header>header</Header><Layout><Sider>left sidebar</Sider><Content>main content</Content><Sider>right sidebar</Sider></Layout><Footer>footer</Footer></Layout>
Common props ref:Common props
The wrapper.
Property | Description | Type | Default |
---|---|---|---|
className | Container className | string | - |
hasSider | Whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering | boolean | - |
style | To customize the styles | CSSProperties | - |
The sidebar.
Property | Description | Type | Default |
---|---|---|---|
breakpoint | Breakpoints of the responsive layout | xs | sm | md | lg | xl | xxl | - |
className | Container className | string | - |
collapsed | To set the current status | boolean | - |
collapsedWidth | Width of the collapsed sidebar, by setting to 0 a special trigger will appear | number | 80 |
collapsible | Whether can be collapsed | boolean | false |
defaultCollapsed | To set the initial status | boolean | false |
reverseArrow | Reverse direction of arrow, for a sider that expands from the right | boolean | false |
style | To customize the styles | CSSProperties | - |
theme | Color theme of the sidebar | light | dark | dark |
trigger | Specify the customized trigger, set to null to hide the trigger | ReactNode | - |
width | Width of the sidebar | number | string | 200 |
zeroWidthTriggerStyle | To customize the styles of the special trigger that appears when collapsedWidth is 0 | object | - |
onBreakpoint | The callback function, executed when breakpoints changed | (broken) => {} | - |
onCollapse | The callback function, executed by clicking the trigger or activating the responsive layout | (collapsed, type) => {} | - |
{xs: '480px',sm: '576px',md: '768px',lg: '992px',xl: '1200px',xxl: '1600px',}
토큰 이름 | 설명 | 타입 | 기본값 |
---|---|---|---|
bodyBg | 主体部分背景色 | string | #f5f5f5 |
footerBg | 页脚背景色 | string | #f5f5f5 |
footerPadding | 页脚内边距 | undefined | Padding<string | number> | 24px 50px |
headerBg | 顶部背景色 | string | #001529 |
headerColor | 顶部文字颜色 | string | rgba(0, 0, 0, 0.88) |
headerHeight | 顶部高度 | string | number | 64 |
headerPadding | 顶部内边距 | undefined | Padding<string | number> | 0 50px |
lightSiderBg | 亮色主题侧边栏背景色 | string | #ffffff |
lightTriggerBg | 亮色主题侧边栏开关背景色 | string | #ffffff |
lightTriggerColor | 亮色主题侧边栏开关颜色 | string | rgba(0, 0, 0, 0.88) |
siderBg | 侧边栏背景色 | string | #001529 |
triggerBg | 侧边栏开关背景色 | string | #002140 |
triggerColor | 侧边栏开关颜色 | string | #fff |
triggerHeight | 侧边栏开关高度 | string | number | 48 |
zeroTriggerHeight | collapse 为 0 时侧边栏开关高度 | number | 40 |
zeroTriggerWidth | collapse 为 0 时侧边栏开关宽度 | number | 40 |