Browse components

component

Chat Avatar

A round avatar that falls back to the first letter of the name.

Install

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

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

Preview

Perfume Violeta
demos/chat-avatar.tsx
import { ChatAvatar } from "@/registry/whatsapp/chat-avatar";

export default function Demo() {
  return (
    <div className="flex flex-wrap items-center gap-5">
      <ChatAvatar name="Valeria" />
      <ChatAvatar name="Camila" size={56} />
      <ChatAvatar
        name="Violeta"
        size={56}
        className="bg-[#f2e04f] text-[#3b2f00]"
      />
      <ChatAvatar name="Perfume Violeta" src="/perfume.svg" size={56} />
    </div>
  );
}

Props

Read from ChatAvatarProps in the component source at build time.

ChatAvatarProps
PropTypeDefault
namerequiredstring—
classNamestring—
size

Diameter in pixels.

number40
srcstring—
styleCSSProperties—

Files

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