Browse components

component

Chat Header

Avatar, name and presence line, with slots for a back arrow and trailing actions.

Install

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

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

Preview

Valeria · Agente IA

online

Camila

typing…

Violeta Perfumería

en línea

demos/chat-header.tsx
import { ChatHeader } from "@/registry/whatsapp/chat-header";

export default function Demo() {
  return (
    <div className="flex flex-col gap-4">
      <ChatHeader name="Valeria · Agente IA" presence="online" />
      <ChatHeader name="Camila" presence="typing" />
      <ChatHeader
        name="Violeta Perfumería"
        presence="online"
        presenceLabel="en línea"
        avatarClassName="bg-[#f2e04f] text-[#3b2f00]"
        leading={
          <button
            type="button"
            aria-label="Back"
            className="text-wa-panel-muted"
          >
            ←
          </button>
        }
        actions={
          <button type="button" aria-label="Menu" className="px-1.5">
            ⋮
          </button>
        }
      />
    </div>
  );
}

Props

Read from ChatHeaderProps in the component source at build time.

ChatHeaderProps
PropTypeDefault
namerequiredstring—
actions

Rendered at the far end: call, search, menu.

ReactNode—
avatarClassNamestring—
avatarSrcstring—
classNamestring—
leading

Rendered before the avatar. A back arrow, usually.

ReactNode—
presencePresenceState—
presenceLabel

Overrides the default label for the current presence.

string—

Files

  • registry/whatsapp/chat-header.tsx
  • registry/whatsapp/chat-avatar.tsx
  • registry/whatsapp/types.ts
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE