frames GitHub

A phone and a window, as one web component.

The frame draws the device – bezel, status bar, Dynamic Island, title bar – so a screenshot holds the page and nothing else, and one picture fits any frame.

The finish changes every phone on the page. Switch your device to dark mode to see the dark pictures and the status bar follow.

Tides, a made-up app: a list of places with their tides.

A screenshot

Put a picture inside. A <picture> with a dark source gives the visitor the shot that matches their theme.

<script type="module" src="https://cdn.jsdelivr.net/gh/tor2dbear/frames@v0.1.0/frames.js"></script>

<device-frame finish="natural">
  <picture>
    <source srcset="list-dark.png" media="(prefers-color-scheme: dark)">
    <img src="list-light.png" width="786" height="1704" alt="…">
  </picture>
</device-frame>
Tides at 14rem.
14rem
Tides at 10rem.
10rem
Tides at 7rem, without the glare.
7rem, glare="off"

Live

src instead of a picture: the page itself, laid out at the phone's size and scaled to the frame. Scroll it.

<device-frame src="/app/" title="The app, live" time="10:09"></device-frame>

A window

device="window", as wide as its container.

Tides in a window on a computer.

Attributes

devicephone (default) or window
srca page to show live, instead of the element's children
viewportthe live page's size; a phone's is 393x764, a window's 1280x800
finishblack, natural, white, desert, purple, gold
timethe status bar's clock, 9:41 by default
inkthe status bar's colour: auto, black or white
glareoff leaves the glass without its reflection
titlethe window's title, and a live page's accessible name
--frame-widththe frame's width; everything scales with it

The pictures

frames-capture takes them from the real page, in light and dark, with an iPhone's safe-area insets put into its CSS, so the content sits below the status bar. The status bar is left to the frame.

npm install --save-dev github:tor2dbear/frames playwright
npx frames-capture frames.config.mjs