logoAnt Design X

设计研发组件X MarkdownX SDK演示
  • 介绍
  • 总览
  • 通用
    • Bubble对话气泡
    • Conversations管理对话
    • Notification系统通知
  • 唤醒
    • Welcome欢迎
    • Prompts提示集
  • 表达
    • Attachments输入附件
    • Sender输入框
    • Suggestion快捷指令
  • 确认
    • Sources来源引用
    • Think思考过程
    • ThoughtChain思维链
  • 反馈
    • Actions操作列表
    • FileCard文件卡片
  • 其他
    • XProvider全局化配置

XProvider
全局化配置

为组件提供统一的全局化配置。
使用import { XProvider } from "@ant-design/x";
源码components/x-provider
文档
编辑此页...
更新日志
loading

使用说明

XProvider 继承了 antd 的 ConfigProvider,且为 @ant-design/x 中的组件提供全局化配置。

如果您已经使用 antd 的 ConfigProvider,请对您的代码做如下变更:

diff
- import { ConfigProvider } from 'antd';
+ import { XProvider } from '@ant-design/x';
const App = () => (
- <ConfigProvider>
+ <XProvider>
<YourApp />
- </ConfigProvider>
+ </XProvider>
);

代码演示

API

XProvider 完全继承 antd 的 ConfigProvider, 属性参考:Antd ConfigProvider

国际化

如果您的项目使用了antd 那么需要将antd的locale合并传入XProvider

ts
import { XProvider } from '@ant-design/x';
import zhCN from 'antd/locale/zh_CN';
import zhCN_X from '@ant-design/x/locale/zh_CN';
<XProvider locale={{...zhCN_X,..zhCN}}>
<App />
</XProvider>

组件配置

属性说明类型默认值版本
bubble气泡组件的全局配置{style: React.CSSProperties; styles: Record<string, React.CSSProperties>;className: string; classNames: Record<string, string>;}--
conversations会话组件的全局配置{style: React.CSSProperties; styles: Record<string, React.CSSProperties>;className: string; classNames: Record<string, string>;shortcutKeys: {items?: ShortcutKeys<'number'> | ShortcutKeys<number>[]}}--
prompts提示集组件的全局配置{style: React.CSSProperties; styles: Record<string, React.CSSProperties>;className: string; classNames: Record<string, string>;}--
sender输入框组件的全局配置{style: React.CSSProperties; styles: Record<string, React.CSSProperties>;className: string; classNames: Record<string, string>;}--
suggestion建议组件的全局配置{style: React.CSSProperties; className: string;}-
thoughtChain思维链组件的全局配置{style: React.CSSProperties; styles: Record<string, React.CSSProperties>;className: string; classNames: Record<string, string>;}--
actions操作列表组件的全局配置{style: React.CSSProperties; className: string;}--

ShortcutKeys

ts
type SignKeysType = {
Ctrl: keyof KeyboardEvent;
Alt: keyof KeyboardEvent;
Meta: keyof KeyboardEvent;
Shift: keyof KeyboardEvent;
};
type ShortcutKeys<CustomKey = number | 'number'> =
| [keyof SignKeysType, keyof SignKeysType, CustomKey]
| [keyof SignKeysType, CustomKey];
Change locale of components:
  • 帮我写作
  • AI编码
  • 图片生成
  • 深度搜索
国际化

此处列出 Ant Design X 中需要国际化支持的组件,你可以在演示里切换语言。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Direction:
  • Conversation - 1
  • Conversation - 2
Hello World!
Hello Ant Design X!
Ignite Your Creativity
Tell me a Joke
Hello Ant Design X!
status: success
Ant Design X help you build AI chat/platform app as ready-to-use 📦.
Hello World!
status: success
Pending...
status: pending
方向

这里列出了支持 rtl 方向的组件,您可以在演示中切换方向。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
ColorPrimary:
  • Conversation - 1
  • Conversation - 2
Do you want?
Hot Topics

What are you interested in?

What's new in X?

What's AGI?

Where is the doc?

Design Guide

How to design a good product?

Know the well

Set the AI role

Express the feeling

Start Creating

How to start a new project?

Fast Start

Install Ant Design X

Online Playground

Play on the web without installing

主题

通过 theme 修改主题。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
You can switch sessions using the shortcut key: Alt/⌥ + number
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
快捷键

通过 shortcutKeys 设置快捷键。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code