Browse components

component

Image Message

A photo that bleeds past the bubble padding, with an optional caption below it.

Install

npx shadcn@latest add https://whatsapp-components.crafter.run/r/image-message.json

Writes 4 files into your project, and installs clsx and tailwind-merge.

Preview

Perfume Violeta¿Es este el que tienen?
Perfume Violeta
demos/image-message.tsx
import { ImageMessage } from "@/registry/whatsapp/image-message";
import { MessageBubble } from "@/registry/whatsapp/message-bubble";
import { MessageMeta } from "@/registry/whatsapp/message-meta";

export default function Demo() {
  return (
    <div className="flex flex-col gap-3">
      <MessageBubble
        direction="in"
        meta={<MessageMeta timestamp={new Date(2025, 0, 6, 18, 12)} />}
      >
        <ImageMessage
          src="/perfume.svg"
          alt="Perfume Violeta"
          caption="¿Es este el que tienen?"
        />
      </MessageBubble>

      <MessageBubble
        direction="out"
        meta={
          <MessageMeta timestamp={new Date(2025, 0, 6, 18, 13)} status="read" />
        }
      >
        <ImageMessage src="/perfume.svg" alt="Perfume Violeta" />
      </MessageBubble>
    </div>
  );
}

Props

Read from ImageMessageProps in the component source at build time.

ImageMessageProps
PropTypeDefault
srcrequiredstring—
altstring""
captionReactNode—
classNamestring—
flush

Bleeds the image past the bubble's padding, as WhatsApp does. Turn it off when placing the image somewhere other than directly inside a bubble.

booleantrue
heightnumber—
widthnumber—

Files

  • registry/whatsapp/image-message.tsx
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE