Device frame

A phone, tablet or desktop browser drawn from tokens, with a screen that lays its content out at the device's real width and scales the frame to fit its container. Fill it with live components instead of screenshots; DeviceScreens swaps screens for feature tabs or scroll-synced chapters.

components/device-frame.tsxtheme · material · accent · density · font

Installation

$ pnpm add @vamos-ui/react

The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";

Usage

import { DeviceFrame, DeviceScreens } from "@vamos-ui/react";

<DeviceFrame device="phone" statusBar="09:41" label="Today screen: three tasks due">
  <TodayScreen />
</DeviceFrame>

<DeviceFrame label={current.alt}>
  <DeviceScreens active={tab} screens={features.map((f) => ({ id: f.id, content: f.screen }))} />
</DeviceFrame>

<DeviceFrame device="desktop" url="example.com/pricing" interactive label="Pricing page preview">
  <PricingPage />
</DeviceFrame>

The box reserves its aspect ratio in CSS, so the server render does not shift; the scale is applied once the width is measured.

A static frame is a picture: write label like an image alt (what the screen says), and keep the real information in the page text.

Scaling is a transform: text inside a strongly scaled frame gets small. Keep the important words outside the frame.

Examples

With feature tabs

Tabs drive one phone; every screen stays mounted and slides in. The frame's label follows the tab.

Scroll-synced

An IntersectionObserver picks the chapter crossing the middle; on a page use the viewport as root and a sticky frame.

See your day

Everything due today on one screen, done items crossed out.

Plan the week

Drag tasks between days and see how full each day is.

Share lists

Invite the people you live or travel with to a list.

Tablet and desktop

The same page at 820 and 1280 px; @container queries inside the screen switch the layout. interactive makes it a live, scrollable preview.

Simple plans

Starter€9
Team€18
Business€27

API

DeviceFrame

PropTypeDefault
device
Frame shape. Desktop is a browser window.
"phone" | "tablet" | "desktop""phone"
viewportWidth / viewportHeight
Simulated screen size in CSS px (defaults 390×844, 820×1180, 1280×800).
number—
maxScale
Largest scale; the frame never grows past it.
number1
statusBar
Time at the start of a phone / tablet status bar. Omit to hide the bar.
ReactNode—
url
Address in the desktop browser bar.
string—
interactive
Live content that scrolls inside. Otherwise the content is inert and hidden from assistive technology.
booleanfalse
label
What the screen shows (role="img" name, or the group's name when interactive). Without it a static frame is decorative.
string—
screenClassName
Classes for the screen element (laid out at the viewport size, an @container).
string—

DeviceScreens

PropTypeDefault
screens
All screens; they stay mounted.
{ id, content }[]—
active
Id of the visible screen.
string—
transition
Instant under reduced motion.
"fade" | "slide" | "none""fade"

Helpers

PropTypeDefault
deviceViewports
Default screen sizes.
Record<DeviceKind, { width, height }>—
deviceFrameSize(device, viewport?)
Outer frame size at scale 1.
{ width, height }—