Bubble

A bubble component for chat.
Import

When To Use#

Often used when chatting.

Examples#

hello world!

Basic usage.

      Loading...
    
Good morning, how are you?
What a beautiful day!
Hi, good morning, I'm fine!
Thank you!

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

      Loading...
    
Loading State:

Control the loading state by nxLoading prop.

      Loading...
    
Ant Design X love you!
Ant Design X love you!

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

      Loading...
    

Render as markdown content to show rich text!

Link: Ant Design X

Cooperate with markdown-it to achieve customized rendering content.

      Loading...
    
variant: filled
variant: outlined
variant: shadow
prompt

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

      Loading...
    
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.

Set the shape of the bubble through the nxShape prop.

      Loading...
    
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.

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

      Loading...
    
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...

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

      Loading...
    

API#

nx-bubble#

PropertyDescriptionTypeDefault
[nxContent]Content of the bubblestring''
[nxMessageRender]Custom message rendering templateTemplateRef<{ content: string }> | nullnull
[nxAvatar]Avatar component or propertiesNxBubbleAvatar-
[nxHeader]Header content of the bubblestring | TemplateRef<void> | nullnull
[nxFooter]Footer content of the bubblestring | TemplateRef<void> | nullnull
[nxLoading]Loading stateboolean-
[nxLoadingRender]Custom loading state rendering templateTemplateRef<void> | nullnull
[nxPlacement]Placement of the bubbleNxBubblePlacement'start'
[nxShape]Shape of the bubbleNxBubbleShape'default'
[nxTyping]Typing effect configurationboolean | NxTypingOptionDEFAULT_TYPING_OPTION
[nxVariant]Variant of the bubbleNxBubbleVariant'filled'
(nxContentUpdate)Callback triggered when content is updatedEventEmitter<void>-
(nxTypingComplete)Callback triggered when the typing effect is completedEventEmitter<void>-

nx-bubble-list#

PropertyDescriptionTypeDefault
[nxAutoScroll]Whether to automatically scroll to the latest position when content is updatedbooleantrue
[nxItems]List of bubble itemsNxBubbleListItem[]Required
[nxRoles]Set default properties for bubbles, role will be automatically matchedNxBubbleRoles-
interface NxBubbleListItem {
  key?: string;
  role?: string;
  content?: string;
  loading?: boolean;
  placement?: NxBubblePlacement;
  shape?: NxBubbleShape;
  variant?: NxBubbleVariant;
  typing?: boolean | NxTypingOption;
  avatar?: NxBubbleAvatar;
  headerRender?: TemplateRef<{ content: string; info: { key?: string } }> | null;
  footerRender?: TemplateRef<{ content: string; info: { key?: string } }> | null;
  messageRender?: TemplateRef<{ content: string }> | null;
  loadingRender?: TemplateRef<void> | null;
}