Device Frame
ProNewA phone, tablet or laptop drawn in CSS around a screenshot or a video. It scales with its width and holds the screen's shape while the picture loads.
Installation
pnpm dlx shadcn@latest add @viewport/device-frame
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| device | "phone" | "tablet" | "laptop"The device to draw around the screenshot. | "phone" |
| children* | React.ReactNodeThe screen's contents: an `img`, a `video`, or any element. It fills the screen and is clipped to it. | — |
| finish | "auto" | "dark" | "light"Draws the frame in a dark or a light finish. Defaults to following the theme. | "auto" |
Accessibility
- The frame is decoration; the picture inside carries its own alt text.
- The screen's aspect ratio is fixed, so nothing shifts on load.
- Server component with no client JavaScript.