logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
5.9.2
  • Ant Design of React
  • Changelogv5.9.2
  • Basic Usage
    • Getting Started
    • Usage with create-react-app
    • Usage with Next.js
    • Usage with Umi
    • Usage with Vite
  • Advanced
    • Customize ThemeUpdated
    • CSS Compatible
    • Server Side RenderingNew
    • Use custom date library
    • Internationalization
  • Migration
    • V4 to V5
    • Less variables to Component Token
  • Other
    • Common Props
    • Third-Party Libraries
    • Contributing
    • FAQ
Install and Initialization
Import antd

Usage with Vite

  • Usage with UmiCustomize Theme

    Resources

    Ant Design Charts
    Ant Design Pro
    Ant Design Pro Components
    Ant Design Mobile
    Ant Design Mini
    Ant Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    ahooks-React Hooks Library
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Ant Design
    Medium
    Twitter
    yuqueAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconfSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTechMore Products

    yuqueYuQue-Document Collaboration Platform
    AntVAntV-Data Visualization
    EggEgg-Enterprise Node.js Framework
    kitchenKitchen-Sketch Toolkit
    xtechAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Ant Design Community

    Vite is one of the best React application development tools. We are going to use antd within it and modify the vite config for some customized needs.

    Install and Initialization

    Before all start, you may need install yarn or pnpm.

    npm
    yarn
    pnpm
    $ npm create vite antd-demo

    The tool will create and initialize environment and dependencies automatically, please try config your proxy setting, or use another npm registry if any network errors happen during it.

    Then we go inside antd-demo install dependencies and start it.

    $ cd antd-demo
    $ npm install
    $ npm run dev

    Open the browser at http://localhost:5173/. It renders a header saying Vite + React on the page.

    Import antd

    Below is the default directory structure.

    ├── public
    │   └── vite.svg
    ├── src
    │   └── assets
    │ └── react.svg
    │   ├── App.css
    │   ├── App.js
    │   ├── index.css
    │   ├── main.js
    │   └── logo.svg
    ├── index.html
    ├── package.json
    └── vite.config.ts

    Now we install antd from yarn or npm or pnpm.

    npm
    yarn
    pnpm
    $ npm install antd --save

    Modify src/App.js, import Button component from antd.

    import React from 'react';
    import { Button } from 'antd';
    const App = () => (
    <div className="App">
    <Button type="primary">Button</Button>
    </div>
    );
    export default App;

    OK, you should now see a blue primary button displayed on the page. Next you can choose any components of antd to develop your application. Visit other workflows of Vite at its User Guide.

    We are successfully running antd components now, go build your own application!