Message Scroller
A scrollable conversation with a return-to-bottom control.
Upstream documentationExamples
Loading preview…
Installation
Run the Ninaero registry command to install the component and its dependencies, including shared theme styles.
Install Message Scroller
pnpm dlx shadcn@latest add 'https://ninaero.pages.dev/r/message-scroller.json'Usage
A complete example using the installed component and hook paths.
Message Scroller usage
"use client";import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "@/components/ui/message-scroller";const messages = [ "Choose a surface.", "Compare the borders.", "Try the dark theme.", "Check the text contrast.", "Inspect the focus ring.", "The preview is ready.",];function MessageScrollerPreview() { return ( <MessageScrollerProvider> <MessageScroller className="h-40 w-full rounded-lg border"> <MessageScrollerViewport className="p-3"> <MessageScrollerContent className="gap-3"> {messages.map((message) => ( <MessageScrollerItem key={message}> <p className="rounded-lg bg-muted px-3 py-2 text-sm">{message}</p> </MessageScrollerItem> ))} </MessageScrollerContent> </MessageScrollerViewport> <MessageScrollerButton /> </MessageScroller> </MessageScrollerProvider> );}export default function Demo() { return <MessageScrollerPreview />;}API Reference
Ninaero exports and local defaults are listed below. See the upstream reference for inherited primitive props and additional composition examples.
MessageScrollerProvider
MessageScrollerProvider props
React.ComponentProps<typeof MessageScrollerPrimitive.Provider>MessageScroller
MessageScroller props
React.ComponentProps<typeof MessageScrollerPrimitive.Root>MessageScrollerViewport
MessageScrollerViewport props
React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>MessageScrollerContent
MessageScrollerContent props
React.ComponentProps<typeof MessageScrollerPrimitive.Content>MessageScrollerItem
MessageScrollerItem props
React.ComponentProps<typeof MessageScrollerPrimitive.Item>- scrollAnchor
- false
MessageScrollerButton
MessageScrollerButton props
React.ComponentProps<typeof MessageScrollerPrimitive.Button> & Pick<React.ComponentProps<typeof Button>, "variant" | "size">- direction
- "end"
- variant
- "secondary"
- size
- "icon-sm"
useMessageScroller
Re-exported primitive; see the upstream API reference.
useMessageScrollerScrollable
Re-exported primitive; see the upstream API reference.
useMessageScrollerVisibility
Re-exported primitive; see the upstream API reference.