component
List Message
A body with a list button that opens sectioned, selectable rows.
Install
npx shadcn@latest add https://whatsapp-components.crafter.run/r/list-message.jsonWrites 5 files into your project, and installs clsx and tailwind-merge.
Preview
Catálogo VioletaEstos son los formatos disponibles esta semana.Precios con IVA incluido.
Abierto: open es controlado, así que el estado vive en tu app.Eau de parfumKits
demos/list-message.tsx
import { ListMessage } from "@/registry/whatsapp/list-message";
import { MessageBubble } from "@/registry/whatsapp/message-bubble";
import { MessageMeta } from "@/registry/whatsapp/message-meta";
const sections = [
{
title: "Eau de parfum",
rows: [
{ id: "30", title: "30 ml", description: "$ 42.000" },
{ id: "50", title: "50 ml", description: "$ 65.000" },
],
},
{
title: "Kits",
rows: [{ id: "kit", title: "Kit descubrimiento", description: "5 × 2 ml" }],
},
];
export default function Demo() {
return (
<div className="flex flex-col gap-4">
<MessageBubble
direction="out"
meta={
<MessageMeta timestamp={new Date(2025, 0, 6, 11, 4)} status="read" />
}
>
<ListMessage
title="Catálogo Violeta"
body="Estos son los formatos disponibles esta semana."
buttonLabel="Ver formatos"
footer="Precios con IVA incluido."
sections={sections}
/>
</MessageBubble>
<MessageBubble direction="out">
<ListMessage
body="Abierto: open es controlado, así que el estado vive en tu app."
buttonLabel="Ver formatos"
sections={sections}
open
/>
</MessageBubble>
</div>
);
}Props
Read from ListMessageProps in the component source at build time.
| Prop | Type | Default |
|---|---|---|
bodyrequired | string | — |
buttonLabelrequired | string | — |
sectionsrequired | ListSection[] | — |
className | string | — |
footer | string | — |
onSelect | (row: ListSectionRow) => void | — |
onToggle | () => void | — |
openControlled: shows the rows inline instead of only the button. | boolean | false |
title | string | — |
Files
- registry/whatsapp/list-message.tsx
- registry/whatsapp/types.ts
- registry/whatsapp/cn.ts
- registry/whatsapp/whatsapp.css
- LICENSE