Chat with Image Attachments
A chat interface where messages can carry one or more image attachments, both user-uploaded reference photos and AI-generated image results, rendered inline above the message bubble. The composer row shows file and image upload indicator icons alongside a text input.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its media-slot dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/chat-with-image-attachments.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat15.tsx instead.
Usage
The file also exports chat15Demo, 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 { Chat15, chat15Demo } from "@/components/blocks/chat/chat15"; export default function Page() { return <Chat15 {...chat15Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| messages | Chat15Message[] | none | Message thread, each message optionally carrying image attachments. |
| className | string | none | Extra classes for the outer wrapper element. |
Types
export interface Chat15Image { src: string; alt: string; } export interface Chat15Message { id: string; role: "user" | "assistant"; name: string; avatar?: { src: string; alt: string }; timestamp: string; text?: string; images?: Chat15Image[]; }
Behavior notes
- This is a plain Server Component, no client-side state at all: there is no click-to-enlarge lightbox, image attachments are inline previews only.
- The paperclip and image-upload icons in the composer are purely decorative labels (aria-label on a non-interactive span), they don't open a file picker and have no event handler, matching the rule that Server Components can't carry event handlers.
- Image attachments render via the shared MediaSlot helper, which falls back to a placeholder gradient if a message's image has no real src.
- The text input in the composer is an uncontrolled, non-functional preview field, nothing is submitted.
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.