logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
5.25.0
  • Ant Design of React
  • Changelog
    v5.25.0
  • Basic Usage
    • Getting Started
    • Usage with Vite
    • Usage with Next.js
      Updated
    • Usage with Umi
    • Usage with Rsbuild
    • Usage with Farm
    • Usage with Refine
  • Advanced
    • Customize Theme
    • CSS Compatible
    • Server Side Rendering
    • CSS Variables
      New
    • Use custom date library
    • Internationalization
    • Common Props
    • React 19 Compatibility
      New
  • Migration
    • V4 to V5
    • Less variables to Component Token
  • Other
    • Third-Party Libraries
    • Contributing
    • FAQ

Usage with Vite

Resources

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

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

Vite is one of the best React application development tools. Let's use antd within it.

Install and Initialization

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

npm iconnpm
yarn iconyarn
pnpm iconpnpm
Bun LogoBun
bash
$ 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.

bash
$ 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 or bun.

npm iconnpm
yarn iconyarn
pnpm iconpnpm
Bun LogoBun
bash
$ npm install antd --save

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

jsx
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!