Browse components

component

Document Message

File name, page count, type and size, with the extension stamped on the icon.

Install

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

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

Preview

PDFficha-violeta-50ml.pdf3 pages · PDF · 486 kBNotas olfativas y duración.
CSVorden-2291.csvCSV · 2.4 kB
demos/document-message.tsx
import { DocumentMessage } from "@/registry/whatsapp/document-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="out"
        meta={
          <MessageMeta timestamp={new Date(2025, 0, 6, 18, 15)} status="read" />
        }
      >
        <DocumentMessage
          fileName="ficha-violeta-50ml.pdf"
          pageCount={3}
          byteSize={486_000}
          caption="Notas olfativas y duración."
        />
      </MessageBubble>

      <MessageBubble direction="in">
        <DocumentMessage fileName="orden-2291.csv" byteSize={2_400} />
      </MessageBubble>
    </div>
  );
}

Props

Read from DocumentMessageProps in the component source at build time.

DocumentMessageProps
PropTypeDefault
fileNamerequiredstring—
byteSizenumber—
captionReactNode—
classNamestring—
extensionstring—
hrefstring—
pageCountnumber—

Files

  • registry/whatsapp/document-message.tsx
  • registry/whatsapp/format-media.ts
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE