Complete AI Chat Interface
A full-featured chatbot window: a message thread with distinct assistant and user avatars and fixed timestamps, an optional typing indicator, and a rich composer with a real controlled textarea and a send button.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its avatar, avatar-initials, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/complete-ai-chat-interface.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat11.tsx instead.
Usage
The file also exports chat11Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Chat11, chat11Demo } from "@/components/blocks/chat/chat11"; export default function Page() { return <Chat11 {...chat11Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| assistantName | string | "Assistant" | Assistant display name and avatar initials source. |
| assistantAvatar | { src: string; alt: string } | none | Optional assistant avatar image. |
| userName | string | "You" | User display name and avatar initials source. |
| userAvatar | { src: string; alt: string } | none | Optional user avatar image. |
| messages | Chat11Message[] | none | Message thread to render, oldest first. |
| showTypingIndicator | boolean | false | Shows a static three-dot typing indicator below the last message. |
| className | string | none | Extra classes for the outer wrapper element. |
Types
export interface Chat11Message { id: string; role: "user" | "assistant"; text: string; timestamp: string; }
Behavior notes
- The composer textarea is real controlled state (useState), and the send button clears it, but no message is ever appended to the thread and no request is sent, there is no backend behind this block.
- Timestamps are fixed literal strings passed in as data, never computed with new Date(), so the same markup is stable across server and client renders.
- The typing indicator is a static, always-on decorative element when showTypingIndicator is true (three CSS animate-bounce dots with staggered animationDelay), it doesn't reflect any real streaming state.
- Avatars fall back to initials via initialsFromName when no avatar image is supplied.
More Chat Blocks
View all →rich-prompt-input-with-suggestions
Rich Prompt Input with Smart Suggestions
An AI prompt composer with attachment icons, a model selector, and a grid of clickable prompt suggestion cards.
ai-streaming-response-typewriter
AI Streaming Response with Live Typing
A single AI chat exchange with a skeleton loading state, a word-by-word typewriter reveal, and a stop-generating control.
ai-response-with-cited-sources
AI Response with Cited Sources
A Perplexity-style answer with inline numbered citation markers and an expandable source list below it.
code-generation-chat-with-syntax-highlighting
Code Generation Chat with Syntax Highlighting
A developer chat message with a file-name tab bar, a language badge, illustrative syntax coloring, and a real copy button.
prompt-starter-grid
AI Prompt Starter Grid
A tabbed grid of prompt template cards, filterable by category, each with an icon, title, and description.
ai-agent-profile-card
AI Agent Profile Card
A showcase card for an AI agent with avatar, capability badges, a sample chat preview, stats, and action buttons.