MessageScroller is the transport-neutral scroll container behind
ChatTranscript: it follows new content by default, stops following when the
reader scrolls away, and exposes a jump button without coupling the UI to a
Gateway or streaming client.
Props
The forwarded
MessageScrollerHandle provides scrollToBottom(behavior?) and
isFollowing(). stickToBottom={false} disables all automatic scrolling while
retaining fades and one-shot jump behavior.
Compound anatomy
For full control over the transcript layout, compose the scroller from its parts instead of using the flat form. The provider owns all scroll state; the parts subscribe to it through context, so they must render insideMessageScrollerProvider.
MessageScrollerProvider
Owns follow state, item registration, visibility tracking, and the imperative commands. Not a visual element.MessageScrollerViewport
The scrollable region (role="region", single tab stop,
aria-label="Conversation messages"). Forwards the ref and all div props
except onScroll.
MessageScrollerContent
The message list container. Accepts alldiv props; role defaults to
"log" for live-log semantics.
MessageScrollerItem
One registered message wrapper withcontent-visibility optimization. Accepts
all div props.
MessageScrollerButton
Jump affordance that stays rendered and goes inert (data-active="false", no
focus stop) while there is nothing to scroll toward. Accepts all button
props except onClick.
Hooks
Flat-form compatibility
The flatMessageScroller documented above is unchanged and remains the
drop-in scrollport. Its props map onto the compound anatomy:
stickToBottom is scrollAnchor="bottom" on the provider, fade,
contentClassName, hideJumpToLatest, and jumpToLatestLabel configure the
built-in viewport, content, and jump button, and the handle exposes the same
commands as useMessageScroller(). When a flat MessageScroller renders
inside an ambient MessageScrollerProvider it does not nest a second
scroller: it becomes a styled frame (data-slot="message-scroller" with
data-following / data-streaming / data-autoscrolling) and renders its
compound-anatomy children verbatim against the ambient provider’s state.