Component · Free prompt
Chat Message List
Chat Message List is a complete, paste-ready component build-prompt — a full art-direction spec for Lovable, Bolt, v0, Cursor and Claude. It's free: copy it below and paste it into your builder.

Chat Message ListComponent · free prompt · copy-paste
The ChatMessageList component (chat-message-list.tsx) is a simple wrapper component for the <ChatBubble> components.
It also includes a custom useAutoScroll hook which has been architected to handle auto-scrolling, enabling the user to opt in and out of autscrolling.
— Install —
npx shadcn@latest add "https://21st.dev/r/chat-message-list"
— Component source (Chat Message List.tsx) —
import * as React from "react";
import { ArrowDown } from "lucide-react";
import { Button } from "@/components/ui/button";
import { useAutoScroll } from "@/components/hooks/use-auto-scroll";
interface ChatMessageListProps extends React.HTMLAttributes<HTMLDivElement> {
smooth?: boolean;
}
const ChatMessageList = React.forwardRef<HTMLDivElement, ChatMessageListProps>(
({ className, children, smooth = false, ...props }, _ref) => {
const {
scrollRef,
isAtBottom,
autoScrollEnabled,
scrollToBottom,
disableAutoScroll,
} = useAutoScroll({
smooth,
content: children,
});
return (
<div className="relative w-full h-full">
<div
className={`flex flex-col w-full h-full p-4 overflow-y-auto ${className}`}
ref={scrollRef}
onWheel={disableAutoScroll}
onTouchMove={disableAutoScroll}
{...props}
>
<div className="flex flex-col gap-6">{children}</div>
</div>
{!isAtBottom && (
<Button
onClick={() => {
scrollToBottom();
}}
size="icon"
variant="outline"
className="absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md"
aria-label="Scroll to bottom"
>
<ArrowDown className="h-4 w-4" />
</Button>
)}
</div>
);
}
);
ChatMessageList.displayName = "ChatMessageList";
export { ChatMessageList };
Browse & preview free Unlock everything — from $19/mo





