Skip to content

BubbleList Bubble List ๐Ÿ… โ€‹

๐Ÿ“Œ Warning

Added in version 1.1.6 Inherits the fog effect from the typewriter. Added scroll to bottom button, similar to Doubao๐Ÿ”ฅ. Added scrollbar on mouse hover to enhance interaction experience. Please update and try it out.

๐Ÿต This warm tip was last updated: 2025-04-13

๐Ÿ’ก Tip

Note: The new version's auto-scroll will automatically scroll when the list length changes. However, after scrolling up, you need to manually call the scrollToBottom method to re-enable auto-scroll. Or, when the scrollbar reaches the bottom, auto-scroll will be triggered again.

The logic is the same as before, so you can upgrade without any worries.

Introduction โ€‹

BubbleList relies on the Bubble component and is used to display a list of chat bubbles. This component supports setting the maximum list height and has an auto-scroll feature. It also provides various scroll control methods that users can easily call. It is powerful and requires no mental burden for developers.

Code Examples โ€‹

Basic Usage โ€‹

cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover

Pre-styled bubble list, quickly create a chat record through a simple Array of messages.

๐Ÿ“Œ Warning

You can pass properties to the built-in Bubble component through the item property. Set properties for each bubble. More flexible usage. For specific properties, please refer to the Bubble component documentation.

All our message operations only need to maintain this array.

Including streaming message settings. Here we don't use interface streaming operations. In our template project, we go through real combat. You can use it as a reference.

๐Ÿ‘‰ Template Project Preview

๐Ÿ‘‰ Template Project Source Code Welcome to star๐Ÿฅฐ

You can also control the maximum height of the list through the max-height property.

Customized List โ€‹

Dynamic content setting
Custom loading
avatar
Element Plus X ๐Ÿง
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
avatar
๐Ÿง User
Hahaha, let me try
avatar
Element Plus X ๐Ÿง
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
avatar
๐Ÿง User
Hahaha, let me try
avatar
Element Plus X ๐Ÿง
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~

๐Ÿ‹ Through #avatar, #header, #content, #loading, #footer slots, you can more flexibly control the rendering of bubble lists

Auto Scroll & Scroll to Specific Position โ€‹

cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try

๐Ÿ‘ You can easily use bubbleListRef component instance methods to control scrolling to specified index.

๐Ÿ’ Component Instance Methods

  • scrollToTop()๏ผšScroll to top
  • scrollToBottom()๏ผšScroll to bottom
  • scrollToBubble(index: number)๏ผšScroll to specified index

Back to Top Button โ€‹

Scrollbar display:
Show on hover
Bottom button loading state:
true
Bottom button color:
Bottom button positionDistance from bottom:
Distance from left:
Bottom button size:
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
cover
๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~๐Ÿ’– Thank you for using Element Plus X ! Your support is our strongest motivation for open source ~
cover
Hahaha, let me try
  • Built-in back to bottom button, similar to Douyin.
  • Scrollbar appears on mouse hover
  • No conflict with built-in auto-scroll, feel free to use

๐Ÿ’Œ Info

Scrollbar Control Properties

  • alwaysShowScrollbar property controls whether to always show scrollbar, default is false.

Bottom Button Customization Properties

  • You can set the threshold for the back to bottom button through the backButtonThreshold property, default is 80, meaning the back to bottom button will appear when the scrollbar is 80px away from the bottom.
  • showBackButton property controls whether to show the back to bottom button, default is true.
  • btnLoading property controls whether to show loading state, default is true.
  • btnColor property controls the color of the back to bottom button, default is #409EFF.
  • backButtonPosition property controls the position of the back to bottom button, default is { bottom: '20px', left: 'calc(50% - 19px)' } can use % to control, like { bottom: '10%', left: 'calc(50% - 19px)' }.
  • btnIconSize property controls the icon size of the back to bottom button, default is 24.

Scroll Complete Event โ€‹

๐Ÿ“Œ Warning

This is only needed in very special cases. It is not suitable for streaming output, as it will quickly trigger the typing end event.

trigger-indices:

๐Ÿ‰This property is rarely used, please use it judiciously for more fine-grained control over your bubble's completion events in the list.

You can trigger the list through the @complete event, which calls back when each typing Bubble component completes typing. @complete returns two parameters: instance is the typewriter component instance and index is the index of BubbleListItem.

๐Ÿ’ก Tip

  • The @complete event will only trigger callback events for Bubble components with typing property set to true.
  • If you configure multiple bubbles with typing property in the list, the list by default only handles the @complete event of the last bubble with typing set to true.

๐Ÿ’Œ Info

  • If you need to handle completion callback events for multiple bubbles with typing set to true, you can specify the indices of bubbles to handle through the triggerIndices property. It's of type 'only-last' | 'all' | number[].
  • Default is 'only-last', only executes the @complete event of the last bubble with typing set to true.
  • 'all' means execute @complete events for all bubbles with typing set to true. @complete will be executed multiple times.
  • number[] sets the indices of BubbleListItem you want to monitor. The component will automatically filter invalid indices and output console.warn

Props โ€‹

NameType
Required
DefaultDescription
listArrayYesNoneArray containing bubble information. Each element is an object with content, placement, loading, shape, variant, isMarkdown, typing, and other Bubble properties to configure the display and style of each bubble.
maxHeightStringNo'500px'Maximum height of the bubble list container. A vertical scrollbar appears if exceeded.
alwaysShowScrollbarBooleanNofalseWhether to always show the scrollbar. Default is false.
backButtonThresholdNumberNo80Scrollbar display threshold. When the scrollbar is less than this distance from the bottom, the scrollbar will be shown.
showBackButtonBooleanNotrueWhether to show the back to top button. Default is true.
backButtonPosition{ bottom: '20px', left: 'calc(50% - 19px)' }No{ bottom: '20px', left: 'calc(50% - 19px)' }Position of the back to top button. Default is centered at the bottom.
btnLoadingBooleanNotrueWhether to enable loading state for the back to top button. Default is true.
btnColorStringNo'#409EFF'Color of the back to top button. Default is '#409EFF'.
btnIconSizeNumberNo24Icon size of the back to top button. Default is 24px.
triggerIndices'only-last' | 'all' | number[]No'only-last'Index array of bubbles that trigger the complete event. Default is 'only-last'.

Events โ€‹

Event NameParameterTypeDescription
@complete(instance, index)FunctionTriggered when the typing effect of a bubble is completed.

Ref Instance Methods โ€‹

NameTypeDescription
scrollToTopFunctionScroll to the top.
scrollToBottomFunctionScroll to the bottom.
scrollToBubbleFunctionScroll to the specified bubble index.

Slots โ€‹

Slot NameParameterTypeDescription
#avatar-SlotCustom avatar display content
#header-SlotCustom bubble header content
#content-SlotCustom bubble content
#loading-SlotCustom bubble loading state content
#footer-SlotCustom bubble footer content

Features โ€‹

  1. Smart Scrolling - Automatically tracks the latest message position
  2. Deep Customization - Full slot passthrough for bubble components
  3. Multiple Scrolling Methods - Scroll to top, bottom, or specific position
  4. Typing Effect - Supports typing effect
  5. Multiple Styles - Supports various styles such as round, square, etc.