What this thread does
As of November 2026, use shadcn’s MessageScroller composition for streaming chat. Do first: follow the nesting in the Message Scroller docs, then install the parts named in the chat rule.
The problem
Left alone, agents build a chat screen from a div with overflow-y-auto, manual scroll-to-bottom code and bg-primary bubbles. It tends to jump while streaming and is hard to restyle.
What the source says
The shadcn skill in shadcn-ui/ui (MIT) has a chat rule. Its install line: npx shadcn@latest add message-scroller message bubble attachment marker trace code-block. Its rules:
- A scrolling conversation uses
MessageScroller(provider, viewport, content, items, a jump button); every direct child of the content is wrapped in aMessageScrollerItem. Not a raw overflow container, notScrollArea. - A message row is
Messagewithalign="end"for the current user; group rows from one sender withMessageGroup. - The coloured surface is
BubbleplusBubbleContent, never adivwithbg-muted; reactions useBubbleReactions. - File cards are
Attachment, withstatewired to the real upload status. - Status lines and date dividers are
Marker. - What an assistant did (reasoning, tool calls, sources) is a
TraceLineinside aTrace; a pending approval is rendered outside the trace as an item with Approve and Deny. - Code and tool output use
CodeBlock. Streaming, anchoring and jump-to-latest are said to be built in.
The skill's allowed-tools permits npx shadcn@latest CLI commands.
How to describe it to the agent
Build the support chat screen using the shadcn skill's chat rule. Use MessageScrollerProvider with autoScroll around MessageScroller, Message and Bubble for rows (align end for the user), Marker for the date divider, Attachment for uploads and Trace for tool steps. Do not hand-roll scrolling or bubbles. Show me the component tree before writing styles.
Mistakes to check
- The old overflow-div pattern is still in the file after the agent adds the new components.
- Items are not wrapped in
MessageScrollerItem, so anchoring breaks. - Approvals shown as trace rows.
Limits
This is a UI shell: it does not call a model. autoScroll follows the live edge and releases when the reader scrolls away; returning with the jump button resumes following (scroll behavior).
Sources
Started from a post by @shadcn/ui maintainers, packaged by the editor. Original post