From f3cbbc02e9feed0c1460b8348501947cd5fad9ac Mon Sep 17 00:00:00 2001 From: kvetoslavnovak Date: Thu, 13 Oct 2016 06:27:29 +0200 Subject: [PATCH] Site introduction page in line with GitHub one (#3404) --- docs/react/introduce.en-US.md | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/docs/react/introduce.en-US.md b/docs/react/introduce.en-US.md index c909015100..b3c7bc958f 100644 --- a/docs/react/introduce.en-US.md +++ b/docs/react/introduce.en-US.md @@ -37,25 +37,45 @@ We supply a react implementation `antd` following Ant Design specification, whic $ npm install antd ``` -## Example +## Usage + +### Use prebuilt bundle ```jsx import { DatePicker } from 'antd'; ReactDOM.render(, mountNode); ``` -Import style: +And import style manually: ```jsx import 'antd/dist/antd.css'; // or 'antd/dist/antd.less' ``` -You can use: +### Use modularized antd -- `import DatePicker from 'antd/lib/date-picker';` -- `import { DatePicker } from 'antd';` when [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is also used. +- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (Recommended) -> babel-plugin-import supports importing components and styles on demand. + ```js + // .babelrc + { + "plugins": [["import", { libraryName: "antd", style: "css" }]] + } + ``` + + Then you can import components from antd directly. + + ```jsx + // import js and css modularly, parsed by babel-plugin-import + import { DatePicker } from 'antd'; + ``` + +- Manually import + + ```jsx + import DatePicker from 'antd/lib/date-picker'; // just for js + import 'antd/lib/date-picker/style/css'; // with style + ``` ## Version