An out-of-box UI solution for enterprise applications as a React boilerplate. This repository is the layout of Ant Design Pro and was developed for quick and easy use of the layout.
Usage
npm i @ant-design/pro-layout --save
// or
yarn add @ant-design/pro-layout
import ProLayout from '@ant-design/pro-layout';
render(<ProLayout />, document.getElementById('root'));
PageContainer encapsulates the PageHeader component of ant design, adds tabList, and content. Fill in the title and breadcrumb based on the current route. It depends on the route property of the Layout. Of course you can pass in parameters to override the default values. PageContainer supports all the attributes of Tabs and PageHeader.
Property
Description
Type
Default Value
content
Content area
ReactNode
-
extraContent
Extra content area, on the right side of content
ReactNode
-
tabList
Tabs title list
Array<{key: string, tab: ReactNode}>
-
tabActiveKey
The currently highlighted tab item
string
-
onTabChange
Switch panel callback
(key) => void
-
tabBarExtraContent
Extra elements on the tab bar
React.ReactNode
-
PageLoading
a simple loading page
Property
Description
Type
Default Value
tip
loading tip
ReactNode
-
RouteContext
RouteContext can provide built-in data for Layout. For example, isMobile and collapsed, you can consume this data to customize some behavior.
For ease of viewing and use, Typescript is used here to write.
Settings
// can be done via import { Settings } from '@ant-design/pro-layout/defaultSettings' to get this type
export interface Settings {
/**
* theme for nav menu
*/
navTheme: 'light' | 'dark';
/**
* primary color of ant design
*/
primaryColor: string;
/**
* nav menu position: `side` or `top`
*/
layout: 'side' | 'top';
/**
* layout of content: `Fluid` or `Fixed`, only works when layout is top
*/
contentWidth: 'Fluid' | 'Fixed';
/**
* sticky header
*/
fixedHeader: boolean;
/**
* sticky siderbar
*/
fixSiderbar: boolean;
menu: { locale: boolean };
title: string;
pwa: boolean;
// Your custom iconfont Symbol script Url
// eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
// Usage: https://github.com/ant-design/ant-design-pro/pull/3517
iconfontUrl: string;
colorWeak: boolean;
}
MenuDataItem
// can be imported { MenuDataItem } from '@ant-design/pro-layout/typings' to get this type
export interface MenuDataItem {
authority?: string[] | string;
children?: MenuDataItem[];
hideChildrenInMenu?: boolean;
hideInMenu?: boolean;
icon?: string;
locale?: string;
name?: string;
path: string;
[key: string]: any;
}
Route
// can be imported { RouterTypes } from '@ant-design/pro-layout/typings' to get this type
export interface Route {
path: string;
routes: Array<{
exact?: boolean;
icon: string;
name: string;
path: string;
// optional secondary menu
children?: Route['routes'];
}>;
}
Contributing
Any type of contribution is welcome, here are some examples of how you may contribute to this project:
此仓库已废弃
重要: 此仓库后续不再维护,也不再接受更多的特性更新。
ant-design/pro-layout将会迁移至ant-design/pro-components仓库进行后续的维护,访问 https://procomponent.ant.design/layout 了解更多。此变更不影响继续使用@ant-design/pro-layout这个 npm 包名安装使用此组件。English | 简体中文 changelog
Ant Design Pro Layout
An out-of-box UI solution for enterprise applications as a React boilerplate. This repository is the layout of Ant Design Pro and was developed for quick and easy use of the layout.
Usage
Demo
site
API
ProLayout
'Ant Design Pro'(e: React.MouseEvent<HTMLDivElement>) => void'side''Fluid''dark'falsefalseEnum { 'xs', 'sm', 'md', 'lg', 'xl', 'xxl' }lg{ locale: true }SettingsSettings(menuData: MenuDataItem[]) => MenuDataItem[](menuData: MenuDataItem[]) => MenuDataItem[]Layout support for most of Menu by
menuPropsafter 4.5.13.SettingDrawer
SettingsSettingsPageContainer
PageContainer encapsulates the PageHeader component of ant design, adds tabList, and content. Fill in the title and breadcrumb based on the current route. It depends on the route property of the Layout. Of course you can pass in parameters to override the default values. PageContainer supports all the attributes of Tabs and PageHeader.
Array<{key: string, tab: ReactNode}>(key) => voidPageLoading
a simple loading page
RouteContext
RouteContext can provide built-in data for Layout. For example, isMobile and collapsed, you can consume this data to customize some behavior.
GridContent
GridContent encapsulates equal width and streaming The logic of analysis?layout=top). You can see the preview in preview.
getMenuData
Generate menuData and breadcrumb based on the router information.
{locale: true}{ locale: boolean }(menuData: MenuDataItem[]) => MenuDataItem[](data: { id: any; defaultMessage?: string }) => string;getPageTitle
getPageTitle encapsulates the logic based on the title generated on menuData.
{ [path: string]: MenuDataItem }{locale: true}{ locale: boolean }(data: { id: any; defaultMessage?: string }) => string;Data Structure
Settings
MenuDataItem
Route
Contributing
Any type of contribution is welcome, here are some examples of how you may contribute to this project: