Skip to content

Message scroller

A chat viewport that follows new messages while the reader is at the bottom. Adapted from beUI (MIT).

Give it a height: the transcript scrolls inside it. It stays at the end while the reader is within followThreshold (56px) of it, and stops following as soon as they scroll further up. With followOutput={false} the position is yours, through viewportRef.

Following new messages

What changed in the March release?

Twelve tasks shipped. The export moved into the project menu and invoices now show tax per line.

Anything still open?

Three tasks. Two are in review and one has no owner yet.

Following the latest

Busy while a reply streams

Write the launch plan for this week.

The launch plan has four steps. First, freeze the task list on Monday. Second, run the final review on Tuesday and fix what it finds. Third, publish the release notes on Wednesday morning. Fourth, send the invoice for the milestone once the notes are live, and close the project board at the end of the week.

Without following

How do I export a project?

Open the project and choose Export from its menu.

Pick the tasks to include. Closed tasks are left out unless you tick them.

Choose a format. A spreadsheet keeps one row per task, a document groups tasks by milestone.

Select Export. The file is saved to the project and a link is sent to you.

To share it, copy the link from the Files tab of the project.

Installation

npx shadcn@latest add @khaeli/message-scroller

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items
npm packages
  • motion ^12.23.12

Keyboard

Tab
Moves focus to the transcript, which is always a tab stop, then on to what follows it.
Arrow UpArrow Down
Scroll the focused transcript by a line. Scrolling up past the threshold stops following new messages; scrolling back to the end resumes it.
Page UpPage DownHomeEnd
Scroll the focused transcript by a page, or to its start or end.

Accessible name

  • The scrolling region is a section named by label, Conversation unless you set it. Give each transcript on a page its own label.
  • The content is a log with aria-live="polite", so a message added to it is announced.
  • Set busy while a reply streams: it puts aria-busy on the log, so the reply is announced when it is complete and not word by word.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/message-scroller.json