block
Conversation
Renders a ChatItem[] with every content type handled. The declarative layer over the primitives, with a renderContent escape hatch.
Install
npx shadcn@latest add https://whatsapp-components.crafter.run/r/conversation.jsonWrites 25 files into your project, and installs clsx and tailwind-merge.
Preview
Today
¡Hola! ¿Tienen el perfume Violeta?
¡Listo, ya pagué!
Pago confirmado
demos/conversation.tsx
import { Conversation } from "@/registry/whatsapp/conversation";
import { MessageList } from "@/registry/whatsapp/message-list";
import type { ChatItem } from "@/registry/whatsapp/types";
const items: ChatItem[] = [
{ kind: "date", id: "d", date: new Date(2025, 0, 6), label: "Today" },
{
kind: "message",
id: "1",
direction: "in",
timestamp: new Date(2025, 0, 6, 20, 2),
content: { type: "text", text: "¡Hola! ¿Tienen el perfume Violeta?" },
},
{
kind: "message",
id: "2",
direction: "out",
timestamp: new Date(2025, 0, 6, 20, 2),
status: "read",
content: {
type: "product",
title: "Perfume Violeta · 50 ml",
price: "$ 65.000",
imageUrl: "/perfume.svg",
caption: "¡Sí! Nos queda en stock 😍",
},
},
{
kind: "message",
id: "3",
direction: "in",
timestamp: new Date(2025, 0, 6, 20, 5),
content: { type: "text", text: "¡Listo, ya pagué!" },
reactions: [{ emoji: "🎉" }],
},
{ kind: "system", id: "s", tone: "success", text: "Pago confirmado" },
];
export default function Demo() {
return (
<MessageList className="rounded-lg">
<Conversation items={items} />
</MessageList>
);
}Props
Read from ConversationProps in the component source at build time.
| Prop | Type | Default |
|---|---|---|
itemsrequired | ChatItem[] | — |
className | string | — |
dateLabels | DateDividerOptions | — |
groupOptions | GroupOptions | — |
nowReference point for Today / Yesterday. | Date | — |
renderContentReturn undefined to fall through to the built-in renderer. | ( content: MessageContent, message: Message, ) => ReactNode | undefined | — |
timeFormat | TimeFormatOptions | — |
Files
- registry/whatsapp/conversation.tsx
- registry/whatsapp/audio-message.tsx
- registry/whatsapp/cta-button.tsx
- registry/whatsapp/date-divider.tsx
- registry/whatsapp/document-message.tsx
- registry/whatsapp/image-message.tsx
- registry/whatsapp/link-preview.tsx
- registry/whatsapp/list-message.tsx
- registry/whatsapp/location-message.tsx
- registry/whatsapp/message-bubble.tsx
- registry/whatsapp/message-group.tsx
- registry/whatsapp/message-meta.tsx
- registry/whatsapp/message-ticks.tsx
- registry/whatsapp/poll.tsx
- registry/whatsapp/product-card.tsx
- registry/whatsapp/reactions.tsx
- registry/whatsapp/reply-quote.tsx
- registry/whatsapp/system-message.tsx
- registry/whatsapp/cn.ts
- registry/whatsapp/types.ts
- registry/whatsapp/format-time.ts
- registry/whatsapp/format-media.ts
- registry/whatsapp/grouping.ts
- registry/whatsapp/whatsapp.css
- LICENSE