Everything you might need when integrating the hosted runtime.
The runtime resolves device IDs in priority order:
data-device-id attribute — explicit, always wins. - A non-
device-frame CSS class on the element — use an alias or a full device ID.
<!-- Explicit ID via attribute (recommended for colour variants) -->
<img class="device-frame" data-device-id="iphone-17-pro-cosmic-orange"
src="screenshot.png" alt="…">
<!-- Alias via class (auto-updates when new hardware releases) -->
<img class="device-frame iphone-latest" src="screenshot.png" alt="…">
<!-- Full ID via class -->
<img class="device-frame macbook-pro-16" src="screenshot.png" alt="…">
Your screenshot should match the screen resolution listed in the catalogue below — that's the pixel area the bezel artwork exposes. The runtime scales everything via CSS, so you don't need to produce images at native frame resolution; you just need the correct aspect ratio.
If your screenshot has a different aspect ratio to the screen area, object-fit: cover is applied — the image fills the screen, cropped to centre.
Custom selector
By default the runtime targets .device-frame. Pass a custom CSS selector to init() to scope it differently.
window.DeviceFrame.init({
manifest: 'https://jjy.me/deviceframe/v1/manifest.json',
selector: '.my-mockup' // target .my-mockup elements instead
});
Custom aliases
Extend or override the built-in aliases by passing an aliases object.
window.DeviceFrame.init({
manifest: 'https://jjy.me/deviceframe/v1/manifest.json',
aliases: {
...window.DeviceFrame.defaults.aliases, // keep built-ins
'my-phone': 'iphone-17-pro-max' // add your own
}
});
Inline manifest
If you want to avoid the manifest fetch (e.g. for strict CSPs), set window.DEVICE_FRAME_MANIFEST to the manifest object before calling init() and the runtime will use it directly.
Fallback when an asset is missing
If a device has no frame artwork (asset_exists: false in the manifest), the wrapper renders with a plain rounded border and light background — so your screenshot is still displayed cleanly rather than broken.