logoAnt Design X

DesignDevelopmentComponentsX SDKX MarkdownPlayground
  • Overview
  • Common
    • Actions
    • Bubble
    • Conversations
  • Wake
    • Welcome
    • Prompts
  • Express
    • Attachments
    • Sender
    • Suggestion
  • Confirm
    • ThoughtChain
  • Tools
    • useXAgent
    • useXChat
    • XStream
    • XRequest
    • XProvider

Conversations

Used to switch between multiple agents, update conversation turns, and manage conversation history
Importimport { Conversations } from "@ant-design/x";
Sourcecomponents/conversations
Docs
Edit this pageChangelog

Resources

Ant Design
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

When To Use

  • Switch between multiple agents, update conversation turns
  • Need to manage multiple conversations
  • View a list of historical conversations

Examples

API

Common props ref:Common props

ConversationsProps

PropertyDescriptionTypeDefaultVersion
activeKeyCurrently selected valuestring--
defaultActiveKeyDefault selected valuestring--
itemsData source for conversation listItemType[]--
onActiveChangeCallback for selection change(value: string) => void--
menuOperation menu for conversationsItemMenuProps| ((value: ConversationItemType) => ItemMenuProps)--
groupableIf grouping is supported, it defaults to the Conversation.group fieldboolean | GroupableProps--
shortcutKeysShortcut key operations{ creation?: ShortcutKeys; items?:ShortcutKeys<'number'> | ShortcutKeys[];}--
creationNew conversation configurationCreationProps--
stylesSemantic structure stylesstyles?: {creation?: React.CSSProperties;item?: React.CSSProperties;}--
classNamesSemantic structure class namesclassNames?: { creation?: string; item?:string;}--
rootClassNameRoot node classNamestring--

ItemType

tsx
type ItemType = ConversationItemType | DividerItemType;

ConversationItemType

PropertyDescriptionTypeDefaultVersion
keyUnique identifierstring--
labelConversation nameReact.ReactNode--
groupConversation type, linked to ConversationsProps.groupablestring--
iconConversation iconReact.ReactNode--
disabledWhether to disableboolean--

DividerItemType

PropertyDescriptionTypeDefaultVersion
typeDivider type'divider''divider'-
dashedWhether dashedbooleanfalse-

GroupableProps

PropertyDescriptionTypeDefaultVersion
labelGroup titleReact.ReactNode| ((group: string, info: { groupInfo: GroupInfoType}) => React.ReactNode)--
collapsibleCollapsible configurationboolean | ((group: string) => boolean)--
defaultExpandedKeysDefault expanded or collapsed groupsstring[]--
onExpandExpand or collapse callback(expandedKeys: string[]) => void--
expandedKeysExpanded group keysstring[]--

ItemMenuProps

Inherits antd MenuProps properties.

tsx
MenuProps & {
trigger?:
| React.ReactNode
| ((
conversation: ConversationItemType,
info: { originNode: React.ReactNode },
) => React.ReactNode);
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
};

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
creationBgColorNew conversation button background colorstringrgba(22,119,255,0.15)
creationBorderColorNew conversation button border colorstringrgba(22,119,255,0.22)
creationHoverColorBackground color of default new conversation button when hoverstringrgba(22,119,255,0.25)
shortcutKeyTextColorShortcut key identification font colorstringrgba(22,119,255,0.65)
Global TokenHow to use?
Basic

Basic usage.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Controlled Mode

Use the activeKey and onChange property to configure conversation.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Operations

Use the menu property to configure conversation.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Custom Operations

Customize the menu trigger.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Group

After using groupable properties open group, open the default according to Conversation.Group field group

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Group collapsible

Configure the collapsible property to enable group collapsibly‌.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
controlled collapsible mode

Controlled group collapsing‌ function.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
New Chat

New chat.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Custom New Chat

Customize the new chat.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Shortcut key Operation

Set shortcut keys for switching sessions or creating new sessions through shortcutKeys.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Scrolling loaded

The example of infinite load with react-infinite-scroll-component.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
  • Conversation Item 1
  • Conversation Item 2
  • Conversation Item 3
  • Conversation Item 4
  • Conversation Item 1
  • Conversation Item 2
  • Conversation Item 3
  • Conversation Item 4
  • Today
    • This's Conversation Item 1, you can click me!
    • Conversation Item 2
    • Conversation Item 3
  • Yesterday
    • Conversation Item 4
    • Conversation Item 5
    • Conversation Item 6
  • Today(3)
  • Yesterday(3)
  • Today
    • Conversation Item 1
    • Conversation Item 4
    • Conversation Item 7
  • Yesterday
    • Conversation Item 2
    • Conversation Item 5
    • Conversation Item 8
  • Historical chats
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
  • Today
    • Conversation Item 1
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
  • Today
    • Conversation Item 1
You can switch sessions using the shortcut key: Alt/⌥ + number, and create new chat using the shortcut key: Win/⌘ + K.
  • Help Me Write
  • AI Coding
  • Create Image
  • Deep Search
  • More Features
  • Today
    • Conversation Item 1