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.jsonWrites 4 files into your project, and installs clsx and tailwind-merge.
Preview
Valeria
online
Con notch
Valeria
online
Sin notch
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.
| Prop | Type | Default |
|---|---|---|
childrenrequired | ReactNode | — |
className | string | — |
notch | boolean | true |
ratioScreen aspect ratio, height over width. | number | 2.06 |
screenClassName | string | — |
style | CSSProperties | — |
widthTarget screen width in pixels. The frame shrinks below it in a narrow column rather than overflowing; the height follows from `ratio`. | number | 320 |
Files
- registry/whatsapp/phone-frame.tsx
- registry/whatsapp/cn.ts
- registry/whatsapp/whatsapp.css
- LICENSE