MessageScroller
A scroll container for a live conversation that follows the newest message until a reader looks away, then hands back an explicit way to return.
A live stream
A message lands every 1.2 seconds. Scroll up while it runs: the scroller stops following, the jump control appears, and clicking it returns you to the live edge.
Usage
import {
MessageScroller,
MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
useMessageScroller,
useMessageScrollerScrollable,
useMessageScrollerVisibility,
} from '@oceanic-hub/brand-system'<MessageScrollerProvider>
<MessageScroller>
<MessageScrollerViewport>
<MessageScrollerContent>
<MessageScrollerItem>…</MessageScrollerItem>
</MessageScrollerContent>
</MessageScrollerViewport>
<MessageScrollerButton>…</MessageScrollerButton>
</MessageScroller>
</MessageScrollerProvider>Composition
Use the following composition to build a MessageScroller:
MessageScrollerProvider
└── MessageScroller
├── MessageScrollerViewport
│ └── MessageScrollerContent
│ └── MessageScrollerItem
└── MessageScrollerButtonPart of the chat family, with Bubble and Message: this is the shell those two
scroll inside, not a replacement for either. Reach for it wherever a conversation or a run log
grows on its own while it is on screen — an agent console, a support thread, an import that is
still writing lines — and a reader needs to be able to scroll up into history without being
yanked back down by the next line arriving.
Upstream's page documents a much bigger component, and most of it is a written refusal.
https://ui.shadcn.com/docs/components/radix/message-scroller ships from a separate package,
@shadcn/react, and covers a full streaming-chat toolkit: anchoring a turn to a role as it is
sent, opening a saved transcript at a chosen position, virtualizing thousands of messages,
loading earlier history without moving the reader, jumping to an arbitrary message by command, a
transcript outline that tracks the current turn, group-chat join markers, and per-message
entrance animation. None of that is here. Two reasons, not one:
@shadcn/reactdeclarespeer react >= 19; this package declares>= 18. Taking the dependency would silently raise the floor for every consumer — a ledgered breaking change, not a lockfile bump.- The behaviour is unfalsifiable under this package's no-test-runner decision. Scroll physics
needs a layout engine;
scrollHeightandclientHeightare0under jsdom, so a test for ANY of the above would pass while proving nothing. Growing the surface would only grow the amount of untested behaviour resting on a human looking at a demo.
So what ships is the one behaviour small enough to own and prove that way: follow the live edge,
stop the instant a reader scrolls away, offer an explicit way back. apps/showcase/examples/ message-scroller-demo.tsx is that proof, not an illustration of it. Scroll physics needs a
layout engine and a jsdom-class runner has none, so this panel plus a human IS the guarantee.
MessageScrollerButton is the built-in way back, but it is not the only one — a surface with
its own unread count or its own icon composes the same two hooks the built-in button does, shown
in the second example: useMessageScrollerVisibility() for whether to show it, scrollToBottom
off useMessageScroller for what it does. Do not key visibility on isAtBottom alone — a
conversation short enough not to overflow is already at the bottom and has nothing to jump to.
A bespoke jump affordance
MessageScrollerButton is the built-in way back; a surface with its own unread count or its own icon composes the same two hooks it does — useMessageScrollerVisibility() for whether to show it, scrollToBottom off useMessageScroller for what it does. Do not key visibility on isAtBottom alone: a conversation short enough not to overflow is already at the bottom and has nothing to jump to.
API Reference
See the MessageScroller API page for every prop of every part, with types, defaults and the contract that pins them. It also documents useMessageScroller, useMessageScrollerScrollable and useMessageScrollerVisibility — exported alongside the parts, and signatures rather than props.