Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

DeviceFrame

Presents HTML, images, and live iframe demos in responsive device silhouettes.

FrameworksAstro · React · Elements

Registry commandlumen add DeviceFrame

InteractionNative markup

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroCode target · live preview uses Astro
View DeviceFrame code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.
astro
---
import { DeviceFrame } from '@santi020k/lumen-astro'
---

<DeviceFrame device="macbook-pro" color="white">
  <iframe
    src="/device-frame-demo"
    title="Lumen component workspace"
    loading="lazy"
    sandbox=""
  ></iframe>
</DeviceFrame>
Edit DeviceFrame in browser

Choose what goes on screen

Image

For screenshots and product artwork. Give the image meaningful alt text and match its aspect ratio to the frame.

HTML

For real components and interactive controls. Content shares the page viewport; use container queries to adapt to the frame.

Iframe

For a complete responsive app. The page inside gets the device viewport, then scales to fit the available space.

Import DeviceFrame and the components in your example from @santi020k/lumen-astro. The framework example above includes React and Elements usage.

astro
<DeviceFrame device="iphone" color="black" scroll={false}>
  <Image src="/screens/mobile.png" alt="Your app's home screen" />
</DeviceFrame>

Size the frame, keep the viewport

The frame fills its parent up to a device-specific maximum. Set the parent width to size the mockup. For an iframe, screenWidth and screenHeight set its internal layout viewport; shrinking the frame does not change its media queries. Preset sizes are demo viewports, not hardware specifications.

Choose device="macbook-pro" for the notched, fuller enclosure or device="macbook-air" for the slim, tapered design. Use orientation="landscape" for iPad Pro. Use color="white", color="black", or a hex color for the hardware; your content keeps its own theme. scroll={false} clips HTML overflow, while an iframe manages its own scrolling.

Embed with intent

Always title an iframe. The examples use sandbox="" for a static demo; enable only the permissions your embedded app needs. Some sites block embedding, so use an embeddable route you control. Camera details stay outside live content and never capture pointer input.

Image options · Astro setup · React setup · Elements setup

02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add DeviceFrame
lumen add DeviceFrame

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
device"macbook-pro" | "macbook-air" | "imac" | "iphone" | "pixel" | "ipad-pro" | "laptop" | "desktop" | "android" | "tablet""laptop"Selects a decorative device silhouette and default screen dimensions.
orientation"portrait" | "landscape"device defaultOrders the screen dimensions for the requested orientation.
tone"light" | "dark""dark"Sets the shell tone independently of the content theme.
color"white" | "black" | hex colortoneOverrides the hardware finish. Accepts 3-, 4-, 6-, or 8-digit hex colors. Content keeps its own theme; invalid colors fall back to tone. CSS can override --ui-device-color.
screenWidth / screenHeightnumberdevice presetSets the iframe layout viewport in CSS pixels; scales it to the available frame width. Elements uses screen-width and screen-height.
scrollbooleantrueAllows screen HTML to scroll. An iframe owns its own scrolling.
childrenAstro slot | ReactNode | child nodesrequiredProvide an Image, titled iframe, or HTML. HTML shares the host viewport; iframe media queries use the screen viewport.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog