2016-08-08 10:32:22 +08:00
---
order: 0
title: Ant Design of React
---
2017-03-28 00:25:29 +08:00
Following the Ant Design specification, we developed a React UI library `antd` that contains a set of high quality components and demos for building rich, interactive user interfaces.
2016-08-08 10:32:22 +08:00
< div class = "pic-plus" >
< img width = "150" src = "https://t.alipayobjects.com/images/rmsweb/T11aVgXc4eXXXXXXXX.svg" >
< span > +< / span >
< img width = "160" src = "https://t.alipayobjects.com/images/rmsweb/T16xRhXkxbXXXXXXXX.svg" >
< / div >
< style >
.pic-plus > * {
display: inline-block!important;
vertical-align: middle;
}
.pic-plus span {
font-size: 30px;
color: #aaa ;
margin: 0 20px;
}
< / style >
---
## Features
2017-01-22 01:19:04 +08:00
- An enterprise-class UI design language for web applications.
2017-01-22 01:15:14 +08:00
- A set of high-quality React components out of the box.
2017-03-28 00:25:29 +08:00
- Written in TypeScript with complete defined types.
2017-01-22 01:15:14 +08:00
- A npm + webpack + [dva ](https://github.com/dvajs/dva ) front-end development workflow.
2016-08-08 10:32:22 +08:00
2017-03-13 15:55:21 +08:00
## Environment Support
2017-01-12 17:57:04 +08:00
2017-03-28 00:25:29 +08:00
* Modern browsers and Internet Explorer 9+
2017-03-13 15:55:21 +08:00
* Server-side Rendering
* [Electron ](http://electron.atom.io/ )
2017-01-12 17:57:04 +08:00
## Version
- Stable: [![npm package ](https://img.shields.io/npm/v/antd.svg?style=flat-square )](https://www.npmjs.org/package/antd)
- Beta: [![ ](https://cnpmjs.org/badge/v/antd.svg?&tag=beta&subject=npm )](https://www.npmjs.org/package/antd)
2017-03-28 00:25:29 +08:00
You can subscribe to this feed for new version notifications: https://github.com/ant-design/ant-design/releases.atom
2017-01-12 17:57:04 +08:00
2016-08-08 10:32:22 +08:00
## Installation
2017-03-02 11:24:44 +08:00
### Using npm or yarn
2017-01-12 17:57:04 +08:00
2017-03-28 00:25:29 +08:00
**We recommend using npm or yarn to install**, it not only makes development easier, but also allow you to take advantage of the rich ecosystem of javascript packages and tooling.
2017-01-12 17:57:04 +08:00
2016-08-08 10:32:22 +08:00
```bash
2016-12-11 18:28:46 +08:00
$ npm install antd --save
2016-08-08 10:32:22 +08:00
```
2017-01-12 17:57:04 +08:00
```bash
2017-03-02 11:24:44 +08:00
$ yarn add antd
2017-01-12 17:57:04 +08:00
```
2017-04-28 18:43:52 +08:00
If you are in a bad network environment, you can try other registries and tools like [cnpm ](https://github.com/cnpm/cnpm ).
2017-03-02 11:24:44 +08:00
2017-01-12 17:57:04 +08:00
### Import in Browser
2017-03-28 00:25:29 +08:00
Add `script` and `link` tags in your browser and use the global variable `antd` .
2017-01-12 17:57:04 +08:00
2017-03-28 00:25:29 +08:00
We provide `antd.js` `antd.css` and `antd.min.js` `antd.min.css` under `antd/dist` in antd's npm package. You can also download these files directly from [![CDNJS ](https://img.shields.io/cdnjs/v/antd.svg?style=flat-square )](https://cdnjs.com/libraries/antd) or [unpkg ](https://unpkg.com/ ).
2017-01-12 17:57:04 +08:00
2017-04-28 18:43:52 +08:00
> **We strongly discourage loading these entire files** this will add bloat to your application and make it more difficult to receive bugfixes and updates. Ant is intended to be used in conjunction with a build tool, such as [webpack](https://webpack.github.io/), which will make it easy to import only the parts of antd that you are using.
2017-01-12 17:57:04 +08:00
2016-10-13 12:27:29 +08:00
## Usage
2016-08-08 10:32:22 +08:00
```jsx
import { DatePicker } from 'antd';
ReactDOM.render(< DatePicker / > , mountNode);
```
2017-03-28 00:25:29 +08:00
And import stylesheets manually:
2016-08-08 10:32:22 +08:00
```jsx
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
```
2016-10-13 12:27:29 +08:00
### Use modularized antd
- Use [babel-plugin-import ](https://github.com/ant-design/babel-plugin-import ) (Recommended)
```js
2017-02-07 17:20:59 +08:00
// .babelrc or babel-loader option
2016-10-13 12:27:29 +08:00
{
2017-03-02 00:34:18 +08:00
"plugins": [
["import", { libraryName: "antd", style: "css" }] // `style: true` for less
]
2016-10-13 12:27:29 +08:00
}
```
2017-03-28 15:58:41 +08:00
This allows you to import components from antd without having to manually import the corresponding stylesheet. The antd babel plugin will automatically import stylesheets.
2016-10-13 12:27:29 +08:00
```jsx
// import js and css modularly, parsed by babel-plugin-import
import { DatePicker } from 'antd';
```
2016-08-08 10:32:22 +08:00
2016-10-13 12:27:29 +08:00
- Manually import
2016-08-08 10:32:22 +08:00
2016-10-13 12:27:29 +08:00
```jsx
2017-03-02 00:34:18 +08:00
import DatePicker from 'antd/lib/date-picker'; // for js
import 'antd/lib/date-picker/style/css'; // for css
// import 'antd/lib/date-picker/style'; // that will import less
2016-10-13 12:27:29 +08:00
```
2016-08-08 10:32:22 +08:00
2017-03-13 15:49:15 +08:00
### TypeScript
```js
// tsconfig.json
{
2017-04-13 14:06:43 +08:00
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
2017-03-13 15:49:15 +08:00
}
```
2017-03-12 15:20:25 +08:00
2017-03-23 15:11:35 +08:00
> Note:
> - set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
2017-03-28 00:25:29 +08:00
> - Don't use @types/antd, antd provides a built-in ts definition already.
2017-03-12 15:20:25 +08:00
## Links
2016-08-08 10:32:22 +08:00
2017-03-12 15:20:25 +08:00
- [Home Page ](http://ant.design/ )
2016-12-12 20:44:40 +08:00
- [UI library ](/docs/react/introduce )
- [Change Log ](/changelog )
2016-12-02 17:00:40 +08:00
- [Scaffold tool ](https://github.com/dvajs/dva-cli/ )
2017-03-12 15:20:25 +08:00
- [rc-components ](http://react-component.github.io/ )
2016-11-14 11:08:26 +08:00
- [Mobile UI ](http://mobile.ant.design )
- [Motion ](https://motion.ant.design )
- [Developer Instruction ](https://github.com/ant-design/ant-design/wiki/Development )
- [Versioning Release Note ](https://github.com/ant-design/ant-design/wiki/%E8%BD%AE%E5%80%BC%E8%A7%84%E5%88%99%E5%92%8C%E7%89%88%E6%9C%AC%E5%8F%91%E5%B8%83%E6%B5%81%E7%A8%8B )
- [Boilerplates ](https://github.com/ant-design/ant-design/issues/129 )
- [FAQ ](https://github.com/ant-design/ant-design/wiki/FAQ )
- [CodePen boilerplate ](http://codepen.io/benjycui/pen/KgPZrE?editors=001 ) for bug reports
- [Awesome Ant Design ](https://github.com/websemantics/awesome-ant-design )
2016-12-12 20:44:40 +08:00
- [Customize Theme ](/docs/react/customize-theme )
2016-08-08 10:32:22 +08:00
2017-03-28 00:25:29 +08:00
## Companies using antd
2016-08-08 10:32:22 +08:00
2016-10-07 21:10:05 +08:00
- [Ant Financial ](http://www.antgroup.com/index.htm?locale=en_US )
- [Alibaba ](http://www.alibaba.com/ )
- [Koubei ](http://www.koubei.com/ )
- [Meituan ](http://www.meituan.com )
- [Didi ](http://www.xiaojukeji.com/ )
2016-08-08 10:32:22 +08:00
2017-03-28 00:25:29 +08:00
> If your company or product uses Ant Design, let us know [here](https://github.com/ant-design/ant-design/issues/477)!
2016-08-08 10:32:22 +08:00
## Contributing
Please read our [CONTRIBUTING.md ](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md ) first.
2017-04-02 14:03:42 +08:00
If you'd like to help us improve antd, just create a [Pull Request ](https://github.com/ant-design/ant-design/pulls ). Feel free to report bugs and issues [here ](http://new-issue.ant.design/ ).
2016-08-08 10:32:22 +08:00
2017-03-28 00:25:29 +08:00
> If you're new to posting issues, we ask that you read [*How To Ask Questions The Smart Way*](http://www.catb.org/~esr/faqs/smart-questions.html) and [How to Ask a Question in Open Source Community](https://github.com/seajs/seajs/issues/545) and [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) prior to posting. Well written bug reports help us help you!
2016-10-19 12:19:30 +08:00
## Need Help?
2017-04-11 18:13:58 +08:00
For questions on how to use antd, please post questions to [stackoverflow ](http://stackoverflow.com/questions/tagged/antd ) using the `antd` tag. If you're not finding what you need on stackoverflow, you can find us on [gitter ](https://gitter.im/ant-design/ant-design-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge ) as well.
2016-10-19 12:19:30 +08:00
2017-03-28 00:25:29 +08:00
As always, we encourage experienced users to help those who are not familiar with `antd` !