@ant-design/x

中文文档
2.10.0发布于 2026/10/29MITTypeScriptESM + CJS近 30 天下载 31.8万

Craft AI-driven interfaces effortlessly

原始使用文档
文档目录12 节
  1. ✨ Features
  2. 📦 Installation
  3. Browser Usage
  4. 🧩 Atomic Components
  5. ⚡️ Model/Agent Integration & Efficient Data Stream Manageme…
  6. ✨ Markdown Renderer
  7. On-demand Loading
  8. TypeScript
  9. Who's Using
  10. Local Development
  11. How to Contribute
  12. Community Support

Ant Design X

Easily build AI-driven interfaces.

CI status codecov NPM version

NPM downloads antd Follow zhihu

Changelog · Report a Bug · Feature Request · 中文 · English

✨ Features

  • 🌈 Best practices from enterprise-level AI products: Based on RICH interaction paradigms, providing excellent AI interaction experience
  • 🧩 Flexible atomic components: Covering most AI scenarios, helping you quickly build personalized AI interaction pages
  • ✨ Stream-friendly, extensible, and high-performance Markdown renderer: Supports streaming formulas, code highlighting, mermaid diagrams, etc. @ant-design/x-markdown
  • 🚀 Out-of-the-box model/agent integration: Easily connect to OpenAI-compatible model/agent services @ant-design/x-sdk
  • ⚡️ Efficient management of large model data streams: Provides handy data stream management features for more efficient development @ant-design/x-sdk
  • 📦 Rich template support: Multiple templates for quick LUI app development Templates
  • 🛡 Full TypeScript coverage: Developed with TypeScript, providing complete type support for better experience and reliability
  • 🎨 Deep theme customization: Fine-grained style adjustments for personalized needs in various scenarios

📦 Installation

npm install @ant-design/x
yarn add @ant-design/x
pnpm add @ant-design/x
ut install @ant-design/x

Browser Usage

Use script and link tags to directly import files and use the global variable antdx.

The npm package's dist directory provides antdx.js, antdx.min.js, and antdx.min.js.map.

Strongly not recommended to use built files as they do not support on-demand loading and may not get quick bug fixes for underlying dependencies.

Note: antdx.js and antdx.min.js depend on react, react-dom, dayjs, antd, @ant-design/cssinjs, and @ant-design/icons. Please make sure to import these files first.

🧩 Atomic Components

Based on the RICH interaction paradigm, we provide many atomic components for different interaction stages to help you flexibly build your AI application:

Here is a simple example of building a dialog using atomic components:

import React from 'react';
import {
  // Message bubble
  Bubble,
  // Sender box
  Sender,
} from '@ant-design/x';

const messages = [
  {
    key: 'message_1',
    content: 'Hello, Ant Design X!',
    role: 'user',
  },
  {
    key: 'x_message_1',
    content: 'Hello, I am Ant Design X!',
    role: 'x',
  },
];

const role = {
  // Bubble position: end
  x: {
    placement: 'end',
  },
};

const App = () => (
  <div>
    <Bubble.List items={messages} role={role} />
    <Sender />
  </div>
);

export default App;

⚡️ Model/Agent Integration & Efficient Data Stream Management

@ant-design/x-sdk provides a series of tool APIs for out-of-the-box management of AI application data streams. See details here.

✨ Markdown Renderer

@ant-design/x-markdown aims to provide a stream-friendly, extensible, and high-performance Markdown renderer. Supports streaming formulas, code highlighting, mermaid diagrams, etc. See details here.

On-demand Loading

@ant-design/x supports tree shaking based on ES modules by default.

TypeScript

@ant-design/x is written in TypeScript and provides complete definition files.

Who's Using

Ant Design X is widely used in AI-driven user interfaces within Ant Group. If your company or product uses Ant Design X, feel free to leave a message here.

Local Development

antx uses npm-workspace to organize code. It is recommended to use npm or utoo for local development.

# Install utoo
$ npm i -g utoo

# Install project dependencies (by utoo)
$ ut [install]

# Start project
$ ut start # Method 1: Start via main package script
$ ut start --workspace packages/x # Method 2: Start via workspace parameter
$ ut start --workspace @ant-design/x # Method 3: Start via package.name (utoo only)
$ cd packages/x && ut start # Method 4: Start in subpackage directory

# Add dependencies
$ ut install [pkg@version] # Add dependency to main package
$ ut install [pkg@version] --workspace packages/x # Add dependency to subpackage
$ cd packages/x && ut install [pkg@version] # Add dependency to subpackage

# Update dependencies
$ ut update # utoo only

How to Contribute

Before participating in any form, please read the Contributor Guide. If you wish to contribute, feel free to submit a Pull Request or Report a Bug.

Highly recommended reading How To Ask Questions The Smart Way, How to Ask Questions in Open Source Community, How to Report Bugs Effectively, and How to Submit Unsolvable Issues to Open Source Projects for better help.

Community Support

If you encounter problems during use, you can seek help through the following channels. We also encourage experienced users to help newcomers through these channels.

When asking questions in GitHub Discussions, please use the Q&A label.

  1. GitHub Discussions
  2. GitHub Issues
Contribution Leaderboard

版本与发布记录

@ant-design/x 共发布 72 个版本,首次发布于 2024/08/13;过去 12 个月发布了 29 个版本。

版本发布日期距今
2.10.0latest2026/10/297 天前
2.9.02026/07/283 个月前
2.8.02026/06/084 个月前
2.8.0-beta.1beta2026/05/145 个月前
2.7.02026/04/306 个月前
2.6.02026/04/176 个月前

其他发布通道:alpha → 2.0.0-alpha.17,beta → 2.8.0-beta.1。

关于 @ant-design/x 的常见问题

@ant-design/x 是什么?

Craft AI-driven interfaces effortlessly

如何安装 @ant-design/x?

在项目目录运行 npm install @ant-design/x,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:antd(^6.1.1)、react(>=18.0.0)、react-dom(>=18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ant-design/x 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ant-design/x 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ant-design/x 可以商用吗?

@ant-design/x 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ant-design/x 的下载量有多少?

根据 npm 官方下载统计,@ant-design/x 在 2026/10/06 – 2026/11/04 这 30 天内被下载 318,067 次,日均约 10,602 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ant-design/x 还在维护吗?

最新版本 2.10.0 发布于 2026/10/29(7 天前);至今共发布 72 个版本,其中过去 12 个月发布了 29 个;首次发布于 2024/08/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。