Device Frame
Wraps any React UI in a phone with notch, status bar and side buttons, or a browser window with a URL bar. Built from theme tokens for light and dark.
Installation
npx shadcn@latest add @minidev/device-frame
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/device-frame.json
Usage
import { DeviceFrame } from "@/components/ui/device-frame"
export function Example() {
return (
<DeviceFrame />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| deviceWhich frame to draw. | "phone""browser" | - |
| urlAddress bar text (browser only). Not a link. | string | - |
| timeStatus bar time (phone only). | string | - |
| childrenThe UI shown on the screen. Defaults to a placeholder. | React.ReactNode | - |
| classNameClasses for the outer frame, e.g. a scale transform. | string | - |
| screenClassNameClasses for the screen area that holds `children`. | string | - |
When to use
Use in heroes, feature rows and scroll stories to show real product UI instead of a screenshot. The phone is a fixed 300×630px frame (scale it with a transform class); the browser fills its container width. Children render inside the screen and stay interactive. For a static image use a plain <img>; for several overlapping devices use the premium DeviceStack.
Accessibility
- The notch, side buttons, signal and battery icons, glass sheen, window dots and lock icon are all
aria-hidden. Onlytime,urland your children are read. - Children stay interactive and in the Tab order. If the UI inside is only an illustration, wrap it in an element with
inertso its controls leave the Tab order.
Frequently asked questions
How do I make the phone frame smaller?
The phone is a fixed 300×630px. Scale it with a transform: className="scale-75 origin-top". A transform does not shrink the space the frame takes in the layout, so add a negative bottom margin to close the gap.
Why don't the bezel highlight and glass sheen move?
They read the kit's light variables (--sx, --sy and --la). LightProvider updates those. Without it they stay at the default top-left light.
Is the address bar a real link?
No. url is plain text in the browser frame and time is plain text in the phone status bar. Neither navigates.
Dependencies
npm
Built from