Staaarter

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.

By Staaarter Team
Chat
Docs
Live preview

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.json

Prefer 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

PropTypeDefaultDescription
messagesChat15Message[]noneMessage thread, each message optionally carrying image attachments.
classNamestringnoneExtra 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.