Components / Chat
Message Scroller
A bottom-anchored message list with a jump-to-latest button.
Install — needs @hiip registered in components.json
bunx shadcn@latest add @hiip/message-scrollerOr by URL, with the token in the query
bunx shadcn@latest add "https://ui.hiip.ai/r/message-scroller.json?token=$HIIP_REGISTRY_TOKEN"Both need a token — set one up.
Anatomy
Import from components/ui/hiip-ui/message-scroller.
<MessageScrollerProvider>
<MessageScroller>
<MessageScrollerViewport>
<MessageScrollerContent>
<MessageScrollerItem />
</MessageScrollerContent>
</MessageScrollerViewport>
<MessageScrollerButton direction="end" />
</MessageScroller>
</MessageScrollerProvider>Examples
function MessageScrollerDemo() {
return (
<div className="h-64 w-full max-w-sm rounded-lg border">
<MessageScrollerProvider>
<MessageScroller>
<MessageScrollerViewport className="p-3">
<MessageScrollerContent className="gap-2">
{MESSAGE_SCROLLER_ROWS.map((row, i) => (
<MessageScrollerItem
key={row}
scrollAnchor={i === MESSAGE_SCROLLER_ROWS.length - 1}
>
<Bubble
variant={i % 3 === 0 ? "sent" : "received"}
align={i % 3 === 0 ? "end" : "start"}
>
<BubbleContent>{row}</BubbleContent>
</Bubble>
</MessageScrollerItem>
))}
</MessageScrollerContent>
</MessageScrollerViewport>
<MessageScrollerButton />
</MessageScroller>
</MessageScrollerProvider>
</div>
);
}API Reference
Generated from the source. Props forwarded to the underlying element are not listed.
MessageScrollerProvider
No props of its own.
MessageScroller
No props of its own.
MessageScrollerViewport
No props of its own.
MessageScrollerContent
No props of its own.
MessageScrollerItem
No props of its own.
MessageScrollerButton
| Prop | Type | Default |
|---|---|---|
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined | "icon-sm" |
variant | "link" | "default" | "secondary" | "outline" | "ghost" | "destructive" | null | undefined | "secondary" |
- Type
registry:ui- Pulls in
- buttonshadcn installs these for you if they are missing.
- npm packages
@shadcn/react @hugeicons/react @hugeicons/core-free-icons- Files written
- components/ui/hiip-ui/message-scroller.tsx