Prodular UI

Message scroller

AI

The scrolling viewport for a conversation: it follows new tokens, anchors each new question to the top and shows a jump to latest button.

npx prodular-ui add message-scroller

Conversation

Each new question scrolls to the top so the answer has room to stream below it.

Which vendors went over budget in Q3?
Ledgerline Copilot

Four vendors went over: Northbeam Logistics by $38,200, Kestrel Analytics by $6,450, Vantage Print by $2,100 and Orbis Cloud by $1,240. Northbeam accounts for 81% of the overrun.

Why is Northbeam so far over?
Ledgerline Copilot

Freight volume to Rotterdam doubled in August after the Halcyon launch, and the contract has no volume discount above 400 pallets a month.

Is there a better rate anywhere?
Ledgerline Copilot

The 2025 quote from Meridian Freight was 14% lower above 400 pallets. It expired in March, so we would need a new quote.

Starting at the top

Activity logs read from the start. Buttons jump to either end.

Step 19:10 AM

Pulled 1,284 card transactions from the September statement

Step 29:14 AM

Matched 1,251 transactions to receipts

Step 39:18 AM

Flagged 19 transactions without receipts

Step 49:22 AM

Asked 7 cardholders for missing receipts

Step 59:26 AM

Coded 1,262 transactions to GL accounts

Step 69:30 AM

Sent 22 transactions to Priya Shah for review

Step 79:34 AM

Posted the September card journal entry

Step 89:38 AM

Closed the September card reconciliation

Anatomy

<MessageScrollerProvider autoScroll>  <MessageScroller>    <MessageScrollerViewport>      <MessageScrollerContent>        <MessageScrollerItem messageId="m1" scrollAnchor>...</MessageScrollerItem>      </MessageScrollerContent>    </MessageScrollerViewport>    <MessageScrollerButton />  </MessageScroller></MessageScrollerProvider>

Guidance

Use it when

  • Around every chat thread or agent log that can grow past the screen.
  • Inside a parent with a fixed height, usually the space between the header and the composer.

Avoid

  • Scrolling the whole page for a chat. The composer should stay in view.
  • Calling scrollIntoView yourself while streaming. The scroller already follows the end.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Wrap with MessageScrollerProvider autoScroll so streamed tokens keep the latest line in view unless the user scrolls up.
  • Give every MessageScrollerItem a stable messageId. Set scrollAnchor on user messages so each new question moves to the top.
  • Give the MessageScroller parent a fixed or flex constrained height and min-h-0, or it will not scroll.
  • Render MessageScrollerButton once inside MessageScroller. It hides itself when the view is already at the end.

API

MessageScrollerProvider

PropTypeDefaultDescription
autoScrollbooleanfalseFollow new content while the view is at the end.
defaultScrollPosition"end" | "start" | "last-anchor""end"Where the view starts.

MessageScrollerItem

PropTypeDefaultDescription
messageIdstringStable id used for anchoring and scrollToMessage.
scrollAnchorbooleanfalseScroll this item to the top when it is added.

MessageScrollerButton

PropTypeDefaultDescription
direction"end" | "start""end"Which end the button jumps to.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add message-scroller# or, with the registry in components.jsonnpx shadcn@latest add @prodular/message-scroller

Used in these screens