# 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.

- Kind: Block (Media)
- Docs: https://ui.minidev.pro/docs/device-frame
- Source (registry JSON with the full file): https://ui.minidev.pro/r/device-frame.json
- License: MIT. One file, yours to edit after install.

## 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.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/device-frame
```

Writes `components/ui/device-frame.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/device-frame.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { DeviceFrame } from "@/components/ui/device-frame"
```

From the npm package:

```tsx
import { DeviceFrame } from "minidev-ui-kit/blocks/device-frame"
```

## Usage

```tsx
import { DeviceFrame } from "@/components/ui/device-frame"

export function Example() {
  return (
    <DeviceFrame />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `device` | `"phone" \| "browser"` | - | no | Which frame to draw. |
| `url` | `string` | - | no | Address bar text (browser only). Not a link. |
| `time` | `string` | - | no | Status bar time (phone only). |
| `children` | `React.ReactNode` | - | no | The UI shown on the screen. Defaults to a placeholder. |
| `className` | `string` | - | no | Classes for the outer frame, e.g. a scale transform. |
| `screenClassName` | `string` | - | no | Classes for the screen area that holds `children`. |

## Accessibility

- The notch, side buttons, signal and battery icons, glass sheen, window dots and lock icon are all `aria-hidden`. Only `time`, `url` and 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 `inert` so its controls leave the Tab order.

## FAQ

### 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`](https://ui.minidev.pro/docs/light-provider) 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.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`

## Related

- [Hero Spotlight](https://ui.minidev.pro/docs/hero-spotlight/md): A launch hero with a pulsing eyebrow, blur-in headline with a cursor lit second line, two actions, a proof line and a product visual that tilts into place.
- [Scroll Story](https://ui.minidev.pro/docs/scroll-story/md): A scrollytelling section: steps scroll on one side while a pinned visual swaps as each reaches mid screen and a progress rail fills. Inline on mobile.
- [Media Library](https://ui.minidev.pro/docs/media-library/md): A Tailwind media library panel with an upload action and a two column grid of assets showing file name, size and a type badge for image, video, vector or doc.
- [Audio Player](https://ui.minidev.pro/docs/audio-player/md): Minimal React audio player row with a play and pause toggle, title, subtitle and an accessible progress bar. Controlled, so it works with any audio source.
- [Avatar](https://ui.minidev.pro/docs/avatar/md): Shadcn compatible avatar on Base UI with image and initials fallback, three sizes, a status badge and an overlapping avatar group with a plus count.
- [Carousel](https://ui.minidev.pro/docs/carousel/md): Scroll snap React carousel with previous and next buttons, arrow key support and a labelled region. Shows one, two or three slides by breakpoint, no library.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
