Chat Container
prompt-kit/chat-containerFreeComponent
A component for creating chat interfaces with intelligent auto-scrolling behavior, designed to provide a smooth and responsive user experience
Live preview
live · rendered by the registry
Rendered by prompt-kit on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/ibelick/prompt-kit/HEAD/public/c/chat-container.jsonSource
1"use client"23import { cn } from "@/lib/utils"4import { StickToBottom } from "use-stick-to-bottom"56export type ChatContainerRootProps = {7 children: React.ReactNode8 className?: string9} & React.HTMLAttributes<HTMLDivElement>1011export type ChatContainerContentProps = {12 children: React.ReactNode13 className?: string14} & React.HTMLAttributes<HTMLDivElement>1516export type ChatContainerScrollAnchorProps = {17 className?: string18 ref?: React.RefObject<HTMLDivElement>19} & React.HTMLAttributes<HTMLDivElement>2021function ChatContainerRoot({22 children,23 className,24 ...props25}: ChatContainerRootProps) {26 return (27 <StickToBottom28 className={cn("flex overflow-y-auto", className)}29 resize="smooth"30 initial="instant"31 role="log"32 {...props}33 >34 {children}35 </StickToBottom>36 )37}3839function ChatContainerContent({40 children,41 className,42 ...props43}: ChatContainerContentProps) {44 return (45 <StickToBottom.Content46 className={cn("flex w-full flex-col", className)}47 {...props}48 >49 {children}50 </StickToBottom.Content>51 )52}5354function ChatContainerScrollAnchor({55 className,56 ...props57}: ChatContainerScrollAnchorProps) {58 return (59 <div60 className={cn("h-px w-full shrink-0 scroll-mt-4", className)}61 aria-hidden="true"62 {...props}63 />64 )65}6667export { ChatContainerRoot, ChatContainerContent, ChatContainerScrollAnchor }
What it pulls in
npm packages
Files it writes
More from prompt-kit
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chain Of Thoughtchain-of-thought | prompt-kit | Components | Free | 1 dep | |
| Code Blockcode-block | prompt-kit | Components | Free | 1 dep | |
| Feedback Barfeedback-bar | prompt-kit | Components | Free | 1 dep | |
| File Uploadfile-upload | prompt-kit | Components | Free | no deps | |
| Imageimage | prompt-kit | Components | Free | no deps | |
| Jsx Previewjsx-preview | prompt-kit | Components | Free | 1 dep | |
| Loaderloader | prompt-kit | Components | Free | no deps | |
| Markdownmarkdown | prompt-kit | Components | Free | 5 deps · 2 files |
