MessageScroller
Chat history scroll container that auto-pins to the latest message while preserving reading position, revealing a floating Liquid Glass Jump to Latest button when scrolled up.
Built on @shadcn/react/message-scroller primitives and fully compatible with the standard shadcn/ui JSX API (MessageScrollerProvider / MessageScroller / MessageScrollerViewport / MessageScrollerContent / MessageScrollerItem / MessageScrollerButton, plus useMessageScroller()):
- Auto-pinning: Automatically follows incoming messages while anchored at the bottom, and preserves reading position without interruption when scrolling up.
- Liquid Glass Jump button:
MessageScrollerButtonfloats above content as a circular Liquid Glass button with Apple easing scale/fade transitions, automatically switching to Over-Glass on glass surfaces and disabling motion under Reduced Motion. - Bottom edge fade: Softly fades the bottom viewport edge with subtle scrollbars hidden during auto-scroll.
Scroll up in the preview below to reveal the Jump to Latest button, or type a message and press Enter to receive an automated reply:
Installation (Shadcn Registry)
npx shadcn@latest add @apple-liquid/message-scrollerUsage
import { Bubble, BubbleContent } from '@/components/ui/bubble';
import { Message, MessageContent } from '@/components/ui/message';
import {
MessageScroller,
MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
} from '@/components/ui/message-scroller';
export function Example({ messages }: { messages: { id: string; text: string }[] }) {
return (
<MessageScrollerProvider autoScroll defaultScrollPosition="end">
<MessageScroller className="h-96">
<MessageScrollerViewport aria-label="Conversation">
<MessageScrollerContent className="p-3">
{messages.map((message) => (
<MessageScrollerItem key={message.id} messageId={message.id}>
<Message>
<MessageContent>
<Bubble variant="secondary">
<BubbleContent>{message.text}</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageScrollerItem>
))}
</MessageScrollerContent>
</MessageScrollerViewport>
<MessageScrollerButton />
</MessageScroller>
</MessageScrollerProvider>
);
}Props API
MessageScrollerProvider
| Prop | Type | Default | Description |
|---|---|---|---|
defaultScrollPosition | 'start' | 'end' | 'last-anchor' | — | Initial scroll position on mount |
autoScroll | boolean | — | Auto-follow new messages when anchored at bottom |
scrollEdgeThreshold | number | — | Distance in px from edge considered "at bottom / top" |
MessageScrollerItem
| Prop | Type | Default | Description |
|---|---|---|---|
messageId | string | — | Message ID for scrollToMessage() and visibility tracking |
scrollAnchor | boolean | false | Marks item as anchor for last-anchor scroll positioning |
MessageScrollerButton
| Prop | Type | Default | Description |
|---|---|---|---|
direction | 'start' | 'end' | 'end' | Scroll to newest or oldest message |
variant | Button['variant'] | 'secondary' | Forwarded to the Liquid Glass Button |
size | Button['size'] | 'icon-sm' | Forwarded to Button |
Language & Text
MessageScroller accepts locale and messages, which apply to all of its parts and the overlays it opens and win over the global <LiquidGlassProvider locale messages>. To override the text globally, put it under messages.messageScroller on the provider. See Liquid Glass → Global settings.
| Prop | Type | Description |
|---|---|---|
locale | LiquidGlassLocaleInput | UI language of this component (any BCP 47 tag; unsupported ones fall back to English) |
messages | Partial<MessageScrollerMessages> | Text overrides, merged over the built-in text and the global messages.messageScroller |
| Key | Built-in text (English) |
|---|---|
scrollToEnd | Scroll to end |
scrollToStart | Scroll to start |
Message
Group chat message row layout combining avatar, sender name, chat bubbles, and delivery status sized to Apple Messages guidelines.
NavigationMenu
Responsive Apple Liquid Glass floating capsule navigation bar with adaptive-size Liquid Glass popovers and directional transitions on desktop, automatically switching to an iOS 27 bottom Liquid Glass Drawer on mobile.