component
CTA Button
A call-to-action attached to the foot of a bubble: open a link, place a call, copy a code, or reply.
Install
npx shadcn@latest add https://whatsapp-components.crafter.run/r/cta-button.jsonWrites 5 files into your project, and installs clsx and tailwind-merge.
Preview
Perfecto, lo despachamos hoy mismo ๐ฆSeguir mi pedidoLlamar a la tienda
demos/cta-button.tsx
import { CtaButton } from "@/registry/whatsapp/cta-button";
import { MessageBubble } from "@/registry/whatsapp/message-bubble";
import { MessageMeta } from "@/registry/whatsapp/message-meta";
export default function Demo() {
return (
<MessageBubble
direction="out"
meta={
<MessageMeta
timestamp={new Date(2025, 0, 6, 20, 6)}
status="delivered"
/>
}
>
Perfecto, lo despachamos hoy mismo ๐ฆ
<span className="-mx-[9px] -mb-[6px] mt-2 block">
<CtaButton
action={{
id: "track",
label: "Seguir mi pedido",
kind: "url",
url: "#",
}}
/>
<CtaButton
action={{ id: "copy", label: "Copiar N.ยฐ de orden", kind: "copy" }}
/>
<CtaButton
action={{
id: "call",
label: "Llamar a la tienda",
kind: "call",
url: "tel:+5115550000",
}}
/>
</span>
</MessageBubble>
);
}Props
Read from CtaButtonProps in the component source at build time.
| Prop | Type | Default |
|---|---|---|
actionrequired | CtaAction | โ |
className | string | โ |
flushDrops the divider above the button, for the first in a stack. | boolean | false |
onSelect | (action: CtaAction) => void | โ |
Files
- registry/whatsapp/cta-button.tsx
- registry/whatsapp/types.ts
- registry/whatsapp/cn.ts
- registry/whatsapp/whatsapp.css
- LICENSE