Message Scroller
New Chat
How can I help you today?
Morning, Shiryoku!
What are we working on today? Press send to start a new conversation
Demo is read only. Press send to send messages.
pnpm dlx shadcn@latest add @sortui/message-scrollerUsage
import {
MessageScrollerProvider,
MessageScroller,
MessageScrollerViewport,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerButton,
} from "@/components/ui/message-scroller"Examples
Anchoring Turns
Anchoring Turns
Choose which role settles near the top edge.
No anchored messages yet
Send the first message to see the selected role anchor.
Toggle the anchor role, then send messages to compare where turns settle.
Group Chat
Group Chat
A group chat with several participants and an assistant. The Marker is marked as a turn.
This will create a marker and make it the anchor
When a user joins, a marker is created. scrollAnchor on the marker marks it as the next turn
Keeping Context Visible
Keeping Context Visible
New turns keep part of the previous reply in view.
Adjust the slider and send. Observe the previous message peek.
Following the Live Edge
Streaming Messages
Auto-scroll follows the live edge of the conversation.
Ready to Stream
Press send to stream a scripted conversation.
Streaming is simulated. autoScroll is enabled.
Opening Saved Threads
Opening Position
Choose where a saved transcript opens.
Toggle the defaultScrollPosition to see where the transcript starts when you open the thread
Loading Earlier Messages
Load History
Prepended messages keep your place.
Restore earlier messages while keeping your place.
Click Load History to load the entire conversation
Animating New Messages
Animation
Choose how user messages are animated when they are added to the conversation.
No Messages Yet
Click the button below to send the first message.
Select an animation then click send to see it in action.
Jumping to Messages
Commands
Drive the transcript from outside.
Use the controls to jump to any message in the conversation.
Tracking the Reader's Position
Transcript Outline
Track the current anchored turn.
Open the outline to jump between anchored turns as you read.
Reading Scroll State
Scroll Status
Where the reader can scroll to from the current position.
All messages fit in the viewport.
Scroll the transcript to see the footer update.