Bubble
A bubble component for chat.
Import
|
Sourcecomponents/bubble |
When To Use
Often used when chatting.
Examples
Basic
string bubble
longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
block block block block block block block block block block block block block block block block block block block block block block block block block
fixed width content
Basic placement: end
string bubble
longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
block block block block block block block block block block block block block block block block block block block block block block block block block
fixed width content
Custom

header
string bubble

header
longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg

header
block block block block block block block block block block block block block block block block block block block block block block block block block

header
fixed width content
Custom placement: end

header
string bubble

header
longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg

header
block block block block block block block block block block block block block block block block block block block block block block block block block

header
fixed width content
List

header
string bubble

header
longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg

header
block block block block block block block block block block block block block block block block block block block block block block block block block

header
fixed width content
hello world !
Good morning, how are you?
What a beautiful day!
Hi, good morning, I'm fine!
Thank you!
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.
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?
API
Common props ref:Common props
Bubble
Property | Description | Type | Default | Version |
---|---|---|---|---|
avatar | Avatar component | React.ReactNode | - | |
classNames | Semantic DOM class | Record<SemanticDOM, string> | - | |
content | Content of bubble | string | - | |
footer | Footer content | React.ReactNode | - | |
header | Header content | React.ReactNode | - | |
loading | Loading state of Message | boolean | - | |
placement | Direction of Message | start | end | start | |
shape | Shape of bubble | round | corner | - | |
styles | Semantic DOM style | Record<SemanticDOM, CSSProperties> | - | |
typing | Show message with typing motion | boolean | { step?: number, interval?: number } | false | |
variant | Style variant | filled | borderless | outlined | shadow | filled | |
loadingRender | Customize loading content | () => ReactNode | - | |
messageRender | Customize display content | (content?: string) => ReactNode | - | |
onTypingComplete | Callback when typing effect is completed. If typing is not set, it will be triggered immediately when rendering. | () => void | - |
Bubble.List
Property | Description | Type | Default | Version |
---|---|---|---|---|
autoScroll | When the content is updated, scroll to the latest position automatically. If the user scrolls, the automatic scrolling will be paused. | boolean | true | |
items | Bubble items list | (BubbleProps & { key?: string | number, role?: string })[] | - | |
roles | Set the default properties of the bubble. The role in items will be automatically matched. | Record<string, BubbleProps> | (bubble) => BubbleProps | - |
Semantic DOM
Ant Design X
Feel free to use Ant Design !
avatar
Wrapper element of the avatarheader
Wrapper element of the headercontent
Wrapper element of the contentfooter
Wrapper element of the footer