2.10.0
中文
Skip to content

Bubble ​

Bubble component for chat.

Usageimport { Bubble } from 'ant-design-x-vue'

Examples ​

Basic ​

Ant Design X
Hello World Next line Tab indent
Basic

Basic usage.

Loading ​

Loading state:
Loading

Controls the loading state through the loading property.

Variant and shape ​

filled - default
filled - round
filled - corner left
filled - corner right
outlined - default
outlined - round
outlined - corner left
outlined - corner right
shadow - default
shadow - round
shadow - corner left
shadow - corner right
borderless bubble
Variant and shape

Sets the bubble style variant through the variant property and the bubble shape through the shape property.

Avatar and placement ​

align left
align right
Avatar and placement

Sets a custom avatar through avatar, placement through placement, and extra content through extra.

header
align left
header
align right
Header

Sets the bubble header through the header property.

footer
outer footer
footer
footer
outer footer and align right
footer
Footer and placement

Sets the bubble footer through the footer property and controls the footer position through footerPlacement.

System message ​

Hello, this is a system message
Hello, this is a system message
Hello, this is a system message
System message

Displays system messages using the Bubble.System component.

Divider ​

message 1
message 2
message 3
message 4
message 5
Divider

Use the Bubble.Divider component to add a separator.

Animation ​

非流式数据 / Non-streaming data:
动画效果 / Animation effects:
保留公共前缀 / Preserve common prefix:
Animation

Configure animation effects through the typing property, supporting two effects: fade-in and typing.

Editable ​

editable bubble 1
editable bubble 2
Editable

Enable editing functionality through the editable property.

Streaming ​

流式数据 / steaming data:
强制关闭流式标志 / Force close the streaming flag:
启用动画 / Enable animation:
onTypingComplete 触发次数 / trigger times: 0
Streaming

Indicate the streaming status through the streaming property, used in conjunction with animation effects.

Custom content render ​

Preview
Ant Design X
Custom content render

Customize rendered content through contentRender.

Render Markdown content ​

Render as markdown content to show rich text!

Link: Ant Design X

Render Markdown content

Render rich text together with Markdown.

GPT visualization ​

Render charts generated by the model in contentRender using @antv/gpt-vis. The vis code block in the browser is handled with new GPTVis({ container }).render(), and destroy() is called when the component is unmounted; server-side rendering does not create a canvas.

GPT-Vis, Components for GPTs, generative AI, and LLM projects. Not only UI Components. more...

Here's a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable growth particularly in recent years.

Use @antv/gpt-vis to draw Haidilao delivery revenue curves inside the bubble. Re-Render will re-stream the output.

Bubble list ​

启用 autoScroll / enabled autoScroll
定位到新气泡 / locate to new bubble
Bubble list

A preset bubble list that supports System and Divider types.

List extensions ​

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.
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.
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.
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...
List extensions

The list supports extensions such as status and extraInfo.

Semantic customization ​

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...
Semantic customization

Custom role configuration, including a custom loadingRender.

List scroll control ​

List scroll control

Use the scrollTo method to control list scrolling.

API ​

Bubble ​

PropDescriptionTypeDefaultVersion
avatarDisplay avatarVNode | (content, info) => VNode-
classNamesSemantic class namesRecord<SemanticDOM, string>-
contentChat contentContentType-
contentRenderCustom rendered content(content: ContentType, info: Info) => VNode--
editableEditable or notboolean | EditableBubbleOptionfalse-
extraExtra ContentVNode(content, info) => VNode-
footerFooter ContentVNode(content, info) => VNode-
footerPlacementFooter Positionouter-startouter-endinner-start
headerHeader ContentVNode(content, info) => VNode-
loadingChat Content Loading Statebooleanfalse
placementMessage Positionstartendstart
shapeBubble Shapedefaultroundcorner
streamingWhether Streamingbooleanfalse-
stylesSemantic stylesRecord<SemanticDOM, CSSProperties>-
typingTyping Animation ConfigurationbooleanBubbleAnimationOptionFunction
variantBubble Style Variantfilledborderlessoutlined
loadingRenderCustom Render Loading Content() => VNode-
messageRenderCustom Render Content (Deprecated, please use contentRender)(content: ContentType) => VNode-
onTypingCallback during animation execution(rendererContent: string, currentContent: string) => void--
onTypingCompleteCallback when animation ends(content?: string) => void-
onEditConfirmCallback when editing is confirmed(content: string) => void--
onEditCancelCallback when editing is canceled() => void--

BubbleAnimationOption ​

PropDescriptionTypeDefault
effectType of animation effecttyping | fade-infade-in
stepContent step unit, array format for random rangenumber | [number, number]6
intervalAnimation trigger intervalnumber100
keepPrefixWhether to keep common prefix when restarting animationbooleantrue

EditableBubbleOption ​

PropDescriptionTypeDefault
editingWhether in edit modebooleanfalse
okTextText for confirm buttonVNode | stringConfirm
cancelTextText for cancel buttonVNode | stringCancel

Info ​

PropDescriptionType
keyUnique identifier for data itemstring | number
statusMessage Statuslocal | loading | updating | success | error | abort
extraInfoAdditional InformationAnyObject

Bubble.System ​

PropDescriptionTypeDefault
contentSystem Message ContentContentType-
variantBubble Style Variantsfilled | borderless | outlined | shadowshadow
shapeBubble Shapedefault | round | corner-
stylesSemantic stylesRecord<SemanticDOM, CSSProperties>-
classNamesSemantic class namesRecord<SemanticDOM, string>-

Bubble.Divider ​

PropDescriptionTypeDefault
contentSeparator ContentContentType-
dividerPropsSeparator PropertiesDividerProps-
stylesSemantic stylesRecord<SemanticDOM, CSSProperties>-
classNamesSemantic class namesRecord<SemanticDOM, string>-

Bubble.List ​

PropDescriptionTypeDefault
autoScrollAutomatic scrolling to the latest locationbooleantrue
itemsBubble Data ListBubbleItemType[]-
rolesBubble default property configuration, equivalent to 'role'. When passing in simultaneously, 'roles'takes precedence RoleType-
roleSame 'role' as React 2.10 'Bubble.List'RoleType-
stylesSemantic stylesRecord<SemanticDOM, CSSProperties>-
classNamesSemantic class namesRecord<SemanticDOM, string>-
onScrollRolling Event Callback(e: Event) => void-

BubbleItemType ​

PropDescriptionType
keyUnique identifier for the data item (required)string
roleRole typeai
statusMessage Statuslocal | loading | updating | success | error | abort
extraInfoAdditional InformationAnyObject
...BubblePropsAll properties inherited from Bubble-

BubbleListRef ​

MethodDescriptionType
nativeElementNative DOM elementHTMLDivElement
scrollBoxNativeElementScroll container DOMHTMLDivElement
scrollToScroll to a specified position(options: ScrollToOptions) => void

ScrollToOptions ​

PropDescriptionType
keyBubble to scroll to by keystring
topScroll positionnumber
offsetScroll offsetnumber
behaviorScroll behaviorsmooth
blockScroll alignmentstart

Bubble Slots ​

SlotDescriptionType
avatarAvatar-
headerHeader Panel
footerFooter Content
extraExtra Content
loadingLoading Placeholder-
contentMessage Content

Bubble.List Slots ​

SlotDescriptionType
avatarAvatar
headerHeader Panel
footerFooter Content
extraExtra Content
loadingLoading Placeholder
contentMessage Content

Semantic DOM ​

Ant Design X Vue
Feel free to use Ant Design Vue !
  • root
    气泡根节点
  • body
    主体容器
  • avatar
    头像的外层容器
  • header
    头部的容器
  • content
    聊天内容的容器
  • footer
    底部的容器
  • extra
    气泡尾边栏容器
System message
  • root
    系统气泡根节点
  • body
    主体容器
  • content
    内容容器
  • root
    分隔符根节点
  • body
    主体容器
  • content
    内容容器
Welcome to Ant Design X Vue
hello, Ant Design X Vue
AI
Hello, nice to meet you!
  • root
    对话列表根节点
  • scroll
    对话列表滚动容器
  • bubble
    对话气泡容器
  • body
    对话气泡的主体容器
  • avatar
    对话气泡的头像外层容器
  • header
    对话气泡的头部容器
  • content
    对话气泡的聊天内容容器
  • footer
    对话气泡的底部容器
  • extra
    对话气泡的尾边栏容器
  • system
    系统气泡容器
  • divider
    分割线气泡容器

Design Token ​

TokenDescriptionTypeDefault
typingContentTyping animation contentstring<code>|</code>
typingAnimationDurationTyping animation durationstring0.8s
typingAnimationNameTyping animation namestringcursorBlink

Contributors ​

Contributors

Loading contributors…