Skip to content
caliper ui docs

Pro

Device frame

Show live UI inside a laptop or a phone. The lid opens and the whole device turns, but the screen is an ordinary subtree laid out at the device's true width (1280 or 390 pixels) inside a size container, so breakpoints and container queries behave exactly as in the product.

Pro
pnpm dlx shadcn@latest add @caliper/device-frame

Halden overview

The revenue dashboard at laptop and phone width, laid out as it ships.

9:41

Halden · Oct 2026

Overview

MRR$48.2k+8.4%
Trials312+21

Revenue, 8 weeks

  • Acme CoTeam$199
  • NorthwindPro$99
  • InitechPro$99
Installs components/ui/device-frame.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source

When to use

Use it for

  • Docs and pages that preview a responsive screen.
  • Comparing the same screen on a laptop and a phone.

Skip it when

  • A hero image. Use real UI so the preview stays honest.
  • Screens with state you cannot lose: changing device remounts the content.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

True width, then scaled
The content is laid out at 1280 or 390 CSS pixels and scaled down to fit the model, so it breaks where the product breaks.

Usage

The body is decoration
The laptop and phone are hidden from assistive technology. The screen content stays in the reading and tab order.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/device-frame

Adds its 7 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { DeviceFrame } from "@/components/ui/device-frame"

The worked example comes with Pro

The 110-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

DeviceFrame

component
PropTypeDefaultDescription
children *ReactNode—The screen. It is laid out at 1280px (laptop) or 390px (phone) wide.
deviceDeviceKind—
defaultDeviceDeviceKind"laptop"
onDeviceChange((device: DeviceKind) => void)—
openboolean—Whether the laptop lid is open.
defaultOpenbooleantrue
onOpenChange((open: boolean) => void)—
defaultTurnnumber0Starting turn in degrees, -40 to 40.
controlsbooleantrueShow the device, lid and turn controls.
statusDepthStatus"ready"
messagesDepthMessages—
onRetry(() => void)—
disabledboolean—
classNamestring—

Accessibility

It is built on native elements and keeps aria-hidden, aria-pressed, aria-label and aria-valuetext in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Surfaces examples