Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Device Frame

ProNew

A 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

PropTypeDefault
device"phone" | "tablet" | "laptop"

The device to draw around the screenshot.

"phone"
children*React.ReactNode

The 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.