logoAnt Design X

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

Bubble

A bubble component for chat.
Importimport { Bubble } from "@ant-design/x";
Sourcecomponents/bubble
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

Often used when chatting.

Examples

API

Common props ref:Common props

Bubble

PropertyDescriptionTypeDefaultVersion
avatarAvatar componentReact.ReactNode-
classNamesSemantic DOM classRecord<SemanticDOM, string>-
contentContent of bubblestring-
footerFooter contentReact.ReactNode | (content: BubbleContentType) => React.ReactNode-
headerHeader contentReact.ReactNode-
loadingLoading state of Messageboolean-
placementDirection of Messagestart | endstart
shapeShape of bubbleround | corner-
stylesSemantic DOM styleRecord<SemanticDOM, CSSProperties>-
typingShow message with typing motionboolean | { step?: number, interval?: number }false
variantStyle variantfilled | borderless | outlined | shadowfilled
loadingRenderCustomize loading content() => ReactNode-
messageRenderCustomize display content(content?: string) => ReactNode-
onTypingCompleteCallback when typing effect is completed. If typing is not set, it will be triggered immediately when rendering.() => void-

Bubble.List

PropertyDescriptionTypeDefaultVersion
autoScrollWhen the content is updated, scroll to the latest position automatically. If the user scrolls, the automatic scrolling will be paused.booleantrue
itemsBubble items list(BubbleProps & { key?: string | number, role?: string })[]-
rolesSet the default properties of the bubble. The role in items will be automatically matched.Record<string, BubbleProps> | (bubble, index) => BubbleProps-

Semantic DOM

Design Token

Basic

Basic usage.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Placement and avatar

Set custom avatar by avatar prop, set the placement of the message by placement prop, which has two preset values: start and end.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Header and footer

Use header and footer properties to set the header and footer of the bubble content.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Loading

Control the loading state by loading prop.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Typing effect

Enable typing output by setting the typing prop. If the updated content is a subset of the previous content, it will continue to output, otherwise it will output again.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Content render

Cooperate with markdown-it to achieve customized rendering content.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Variant

Set the style variant of the bubble through the variant property.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Shape

Set the shape of bubble through shape.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Bubble List

Preset Bubble list. Support auto scroll. Use roles to set default properties of Bubble.

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

Sample for adjusting the bubble effect through semantic and loading customization.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Custom List Content

Customize the content of the bubble list, which is very useful for personalized customization scenarios.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Using GPT-Vis to render charts

Cooperate with @antv/GPT-Vis to achieve customized rendering chart of LLM stream output.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
hello world !
Good morning, how are you?
What a beautiful day!
Hi, good morning, I'm fine!
Thank you!
Ant Design X
Hello, welcome to use Ant Design X! Just ask if you have any questions.
Loading state:
A
A💗
variant: filled
variant: outlined
variant: shadow
variant: borderless to customize

How to rest effectively after long hours of work?

What are the secrets to maintaining a positive mindset?

How to stay calm under immense pressure?

shape: default
This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component.
shape: round
This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component.
shape: corner
This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component. This is a long text message to show the multiline view of the bubble component.
Use roles as:
Mock user content.
Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content. Mock AI content.
Mock user content.
Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content. Mock welcome content.
Mock user content.
Custom loading...
Normal message
ReactNode message

How to rest effectively after long hours of work?

What are the secrets to maintaining a positive mindset?

How to stay calm under immense pressure?

excel-file
.xlsx
Checking the data
word-file
.docx
23%
Ant Design X
Feel free to use Ant Design !
  • avatar
    Wrapper element of the avatar
  • header
    Wrapper element of the header
  • content
    Wrapper element of the content
  • footer
    Wrapper element of the footer