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 Farm

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

Farm is a Rust-Based Web Building Engine to Facilitate Your Web Program and JavaScript Library. This article will try to use Farm to create a project and import antd.

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 farm@latest

During the initialization process, farm provides a series of templates for us to choose, We need choose the React template.

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 project and start it.

bash
$ cd farm-project
$ npm install
$ npm start

Open the browser at http://localhost:9000. It renders a title saying Farm with React on the page, which is considered successful.

Import antd

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/main.tsx, import Button component from antd.

tsx
import React from 'react';
import { Button } from 'antd';
export function Main() {
return (
<div>
<Button type="primary">Button</Button>
</div>
);
}

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 Farm at its Official documentation.

Customize Theme

Ref to the Customize Theme documentation. Modify theme with ConfigProvider:

tsx
import React from 'react';
import { Button, ConfigProvider } from 'antd';
export function Main() {
return (
<ConfigProvider theme={{ token: { colorPrimary: '#00b96b' } }}>
<Button type="primary">Button</Button>
</ConfigProvider>
);
}

We are successfully running the antd components using Rsbuild now, let’s start build your own application!