BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/simple-ai/chat-message-area

Chat Message Area

simple-ai/chat-message-area
FreeComponent

A component that adds auto scrolling functionality to a list of messages.

Live preview

live · rendered by the registry
Rendered by simple-ai on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://simple-ai.dev/r/chat-message-area.json

Source

./src/registry/ui/chat-message-area.tsxsimple-ai.dev/r/chat-message-area.json
1import { ChevronDown } from "lucide-react";
2import { type ComponentProps, useCallback } from "react";
3import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
4import { Button } from "@/components/ui/button";
5import { cn } from "@/lib/utils";
6
7interface ChatMessageAreaScrollButtonProps {
8 alignment?: "left" | "center" | "right";
9 className?: string;
10}
11
12export function ChatMessageAreaScrollButton({
13 alignment = "center",
14 className,
15}: ChatMessageAreaScrollButtonProps) {
16 const { isAtBottom, scrollToBottom } = useStickToBottomContext();
17
18 const handleScrollToBottom = useCallback(() => {
19 scrollToBottom();
20 }, [scrollToBottom]);
21
22 if (isAtBottom) {
23 return null;
24 }
25
26 const alignmentClasses = {
27 left: "left-4",
28 center: "left-1/2 -translate-x-1/2",
29 right: "right-4",
30 };
31
32 return (
33 <Button
34 variant="secondary"
35 size="icon"
36 className={cn(
37 "absolute bottom-4 rounded-full shadow-lg hover:bg-secondary",
38 alignmentClasses[alignment],
39 className,
40 )}
41 onClick={handleScrollToBottom}
42 >
43 <ChevronDown className="h-4 w-4" />
44 </Button>
45 );
46}
47
48type ChatMessageAreaProps = ComponentProps<typeof StickToBottom>;
49
50export function ChatMessageArea({ className, ...props }: ChatMessageAreaProps) {
51 return (
52 <StickToBottom
53 className={cn("flex-1 relative h-full overflow-y-auto", className)}
54 resize="smooth"
55 initial="smooth"
56 {...props}
57 />
58 );
59}
60
61type ChatMessageAreaContentProps = ComponentProps<typeof StickToBottom.Content>;
62
63export function ChatMessageAreaContent({
64 className,
65 ...props
66}: ChatMessageAreaContentProps) {
67 return (
68 <StickToBottom.Content
69 className={cn("max-w-2xl mx-auto w-full h-full py-2", className)}
70 {...props}
71 />
72 );
73}

What it pulls in

npm packages

  • use-stick-to-bottom

Other registry items

  • button

Files it writes

  • ./src/registry/ui/chat-message-area.tsx

Facts

Registry
simple-ai
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on simple-ai simple-ai.dev Alwurts/simple-ai on GitHub Raw registry item This item as JSON

More from simple-ai

All 77 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
base-handlebase-handlesimple-aiComponentsFree1 dep
base-nodebase-nodesimple-aiComponentsFreeno deps
Chat Inputchat-inputsimple-aiComponentsFree7 deps
Chat Messagechat-messagesimple-aiComponentsFreeno deps
Chat Suggestionschat-suggestionssimple-aiComponentsFreeno deps
Editable Handleeditable-handlesimple-aiComponentsFree1 dep
Generate Text Nodegenerate-text-nodesimple-aiComponentsFree1 dep
JSON Schema Editorjson-schema-editorsimple-aiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex