Skip to content
Calm motion: animations on this site only fade, with no movement

MessageScroller ​

Chat viewport

The scrolling transcript of a chat. It opens at the latest message and follows new messages while you are at the bottom. It keeps your place while you read back. It loads history at the top.

Streamed, growing replies are followed too. Pair it with Message and Bubble for the rows and Marker for day separators and typing indicators.

Basic
Today
Megumi
おはよう。今日の予定は?
Tomoya
脚本の続き。第3話まで。
Tomoya
夜までには送る。
Megumi
了解。急がなくていいよ。
Scroll to top → loads 8 older lines without jumping. Scroll up, send → “↓ Latest” appears.
  • It is a named log (label), so new messages are announced politely. While a reply is streaming in, set aria-busy on that message so it is read once when it is done, not word by word.
  • The jump button appears after you scroll up. @reach-top asks for history, and loadHistory(insert) keeps your place while it is added. Scrolling does not animate under reduced motion.

Usage ​

ts
import { BlessMessageScroller } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
thresholdnumber48px from bottom still counted as "at bottom"
topThresholdnumber80px from top that fires `reachTop` (history load)
initial"bottom" | "top""bottom"where to open: latest message or top of transcript
heightstring"400px"
labelstring"Messages"names the transcript
labelsPartial<{ jump: string; }>—

Events

NamePayloadDescription
reachTop[]
atBottom[value: boolean]

Slots

NameScopeDescription
default—
jump—

Exposed

NameTypeDescription
scrollToBottom(behavior?: ScrollBehavior) => void
scrollTo(id: string, behavior?: ScrollBehavior) => void
loadHistory(insert: () => void | Promise<void>) => Promise<void>
atBottomboolean

Released under the MIT License. Character names and artwork belong to their owners.