Message Scroller

Conversation scrolling that follows new content while preserving history reading.

Message Scroller

Default

New content follows the viewport while you are near the bottom. Scroll upward to read history without being pulled down. Prepending earlier direct message children preserves the viewport position. The floating down arrow returns to the latest message; a dot indicates unread content.

Hover a message or focus its action buttons to show the toolbar. Agent messages offer copy, like, dislike, and regenerate; user messages offer copy and edit. Touch devices keep actions visible. The example supports editing questions, toggling feedback, and replacing responses.

Dynamic virtual scrolling

Binding v-model:items enables dynamic-height virtualization, rendering only visible messages and the overscan range. Use [] with stable unique ids. Wrapped text, loaded images, and streamed content are remeasured automatically. Older history preserves the reading position; the bottom follows new content while reading history only marks unread content. Connect and return older messages without merging them yourself. The component provides concurrency protection, id deduplication, retry, and cancellation on unmount. This example includes human and Agent turns, varied answer lengths, and three history pages. virtual=false disables virtualization; omitting items retains the original slot layout.

API

PROPS

Property
Type
Description
default
Example
More
v-model:items
[]
Controlled messages; stable unique ids retain measurements and history position.
—
virtual
Boolean
Use dynamic-height virtualization; false renders all items. Applies only to items mode.
true
estimated-item-height
Number
Initial unmeasured row-height estimate in px; actual heights are measured automatically.
96
overscan
Number
Extra rendered messages before and after the visible range.
5
load-more
History callback receives an AbortSignal and returns older messages in chronological order; merged unique messages update items.
—
has-more
Boolean
Whether more history exists; returning an empty array also stops automatic loading.
true
load-threshold
Number
Distance from the top in px that triggers history loading.
64
height
String | Number
Viewport height. Numbers are pixels; CSS lengths are accepted.
360
auto-follow
Boolean
Follow content while near the bottom. Reading earlier messages pauses following.
true
threshold
Number
Distance from the bottom in pixels that counts as following.
48
label
String
Accessible name, with a localized default.
—

EVENTS

Event
Type
Description
default
Example
More
message-action
(event: ) => void
Default data-message actions include item, index, action, and optional feedback or error; custom message slots listen to SMessage events directly.
—
—
update:items
(items: []) => void
Requests the merged, deduplicated complete message list.
—
—
load-error
(error: unknown) => void
History loading failed; cancellation or unmounting does not report an error.
—
—
follow-change
(following: boolean) => void
Automatic following changed.
—
—
reach-top
() => void
Viewport reached the beginning after scrolling.
—
—

SLOTS

Slot
Scope
Description
default
Example
More
message
{ item: ; index: number; following: boolean }
Customize one data item; defaults to SMessage in items mode.
—
—
default
—
Replace the default content.
—
—
controls
—
Customize edge navigation and unread feedback.
—
—

EXPOSES

Method
Type
Description
default
Example
More
loadMore
() => Promise<void>
Manually requests history through the same concurrency and deduplication flow.
—
—
scrollToTop
() => void
Scroll to the first message; virtual mode uses stable immediate positioning.
—
—
scrollToBottom
(smooth?: boolean) => void
Scroll to the latest message; virtual mode positions immediately, while plain mode supports smooth scrolling.
—
—
following
Boolean
Component-owned following access.
—
—
viewport
HTMLElement | null
Component-owned viewport access.
—
—
Last Updated: 2026-10-28, 06:17:56 UTC
Copied