Browse components

Playground

Build a conversation, switch the theme, and take the JSX. Export it declaratively over a ChatItem[], or composed out of the primitives. Both render the same thing.

  • date
  • text
  • product
  • system
import { ChatWindow } from "@/components/ui/whatsapp/chat-window";
import { Conversation } from "@/components/ui/whatsapp/conversation";
import { MessageList } from "@/components/ui/whatsapp/message-list";
import type { ChatItem } from "@/components/ui/whatsapp/types";

const items: ChatItem[] = [
  {
    kind: "date",
    id: "d0",
    date: new Date(2025, 0, 6, 0, 0),
    label: "Today",
  },
  {
    kind: "message",
    id: "m0",
    direction: "in",
    timestamp: new Date(2025, 0, 6, 20, 2),
    content: {
      type: "text",
      text: "¡Hola! ¿Tienen el perfume Violeta?",
    },
  },
  {
    kind: "message",
    id: "m1",
    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: "system",
    id: "s0",
    text: "Pago confirmado",
    tone: "success",
  },
];

export function Chat() {
  return (
    <ChatWindow className="h-[600px]">
      <MessageList>
        <Conversation items={items} />
      </MessageList>
    </ChatWindow>
  );
}

Valeria · Agente IA

en línea

Today
¡Hola! ¿Tienen el perfume Violeta?
Perfume Violeta · 50 ml$ 65.000¡Sí! Nos queda en stock 😍
Pago confirmado