Browse components

component

Phone Frame

A device shell to drop a chat into, for landings and product shots.

Install

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

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

Preview

demos/phone-frame.tsx
import { ChatHeader } from "@/registry/whatsapp/chat-header";
import { ChatWindow } from "@/registry/whatsapp/chat-window";
import { MessageBubble } from "@/registry/whatsapp/message-bubble";
import { MessageList } from "@/registry/whatsapp/message-list";
import { PhoneFrame } from "@/registry/whatsapp/phone-frame";

export default function Demo() {
  return (
    <div className="flex flex-wrap justify-center gap-8 [&>*]:min-w-0 [&>*]:max-w-full">
      <PhoneFrame width={260} ratio={1.9}>
        <ChatWindow>
          <ChatHeader className="pt-9" name="Valeria" presence="online" />
          <MessageList>
            <MessageBubble direction="in">Con notch</MessageBubble>
          </MessageList>
        </ChatWindow>
      </PhoneFrame>

      <PhoneFrame width={260} ratio={1.9} notch={false}>
        <ChatWindow>
          <ChatHeader name="Valeria" presence="online" />
          <MessageList>
            <MessageBubble direction="in">Sin notch</MessageBubble>
          </MessageList>
        </ChatWindow>
      </PhoneFrame>
    </div>
  );
}

Props

Read from PhoneFrameProps in the component source at build time.

PhoneFrameProps
PropTypeDefault
childrenrequiredReactNode—
classNamestring—
notchbooleantrue
ratio

Screen aspect ratio, height over width.

number2.06
screenClassNamestring—
styleCSSProperties—
width

Target screen width in pixels. The frame shrinks below it in a narrow column rather than overflowing; the height follows from `ratio`.

number320

Files

  • registry/whatsapp/phone-frame.tsx
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE