Message Scroller

A transcript that keeps the newest message in view, with a button back to it.

@cupertinoui/message-scrollerRegistry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/message-scroller

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { MessageScroller, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "@/components/ui/message-scroller"

<MessageScrollerProvider>
  <MessageScroller>
    <MessageScrollerViewport>
      <MessageScrollerContent>
        <MessageScrollerItem messageId="1">…</MessageScrollerItem>
      </MessageScrollerContent>
    </MessageScrollerViewport>
  </MessageScroller>
</MessageScrollerProvider>
Built on @shadcn/react's headless Message Scroller.

API Reference

Every part forwards the props of the underlying element. The props below are the ones CupertinoUI adds or changes.

MessageScrollerProvider

PropTypeDescription
autoScrollboolean
Default: true
Follows new messages while at the end.
classNamestringExtra classes, merged with the component's own.

MessageScrollerItem

PropTypeDescription
messageIdstringIdentifies the message, to scroll to it.
classNamestringExtra classes, merged with the component's own.