ant-design/docs/react/introduce.en-US.md
Wei Zhu 7149d1fdff Add offline support (#10738)
* site: add offline support

* test update

* Revert "test update"

This reverts commit e1cb2fba80e44c7d4c248656a4d020cdfb323c0e.

* use reduce
2018-06-02 12:46:09 +08:00

6.3 KiB
Raw Blame History

order title
0 Ant Design of React

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.

+

Features

  • An enterprise-class UI design language for web applications.
  • A set of high-quality React components out of the box.
  • Written in TypeScript with complete defined types.
  • The whole package of development and design resources and tools.

Environment Support

  • Modern browsers and Internet Explorer 9+ (with polyfills)
  • Server-side Rendering
  • Electron

Version

  • Stable: npm package

You can subscribe to this feed for new version notifications: https://github.com/ant-design/ant-design/releases.atom

Installation

Using npm or yarn

We recommend using npm or yarn to installit not only makes development easierbut also allow you to take advantage of the rich ecosystem of Javascript packages and tooling.

$ npm install antd --save
$ yarn add antd

If you are in a bad network environmentyou can try other registries and tools like cnpm.

Import in Browser

Add script and link tags in your browser and use the global variable antd.

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 or unpkg.

We strongly discourage loading the entire files this will add bloat to your application and make it more difficult to receive bugfixes and updates. Antd is intended to be used in conjunction with a build tool, such as webpack, which will make it easy to import only the parts of antd that you are using.

Note: you should import moment before using antd.js after 3.0.

Usage

import { DatePicker } from 'antd';
ReactDOM.render(<DatePicker />, mountNode);

And import stylesheets manually:

import 'antd/dist/antd.css';  // or 'antd/dist/antd.less'

Use modularized antd

  • Use babel-plugin-import (Recommended)

    // .babelrc or babel-loader option
    {
      "plugins": [
        ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }] // `style: true` for less
      ]
    }
    

    Note: Don't set libraryDirectory if you are using webpack 1.

    This allows you to import components from antd without having to manually import the corresponding stylesheet. The antd babel plugin will automatically import stylesheets.

    // import js and css modularly, parsed by babel-plugin-import
    import { DatePicker } from 'antd';
    
  • Manually import

    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
    

TypeScript

  • Don't use @types/antd, as antd provides a built-in ts definition already.

Companies using antd

If your company or product uses Ant Design, let us know here!

Contributing

Please read our CONTRIBUTING.md first.

If you'd like to help us improve antd, just create a Pull Request. Feel free to report bugs and issues here.

If you're new to posting issues, we ask that you read How To Ask Questions The Smart Way and How to Ask a Question in Open Source Community and How to Report Bugs Effectively prior to posting. Well written bug reports help us help you!

Need Help?

For questions on how to use antd, please post questions to Stack Overflow using the antd tag. If you're not finding what you need on stackoverflow, you can find us on Gitter as well.

As always, we encourage experienced users to help those who are not familiar with antd!