---
title: "Device Frame"
description: "The parts to build your own device mockup: a frame that scales to its box, the hardware picture, and a screen at its real size."
url: https://gelatinui.com/components/device-frame
markdown_url: https://gelatinui.com/components/device-frame.md
access: free
install: "npx shadcn@latest add @gelatin-ui/device-frame"
registry_item: https://gelatinui.com/r/device-frame.json
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Device Frame

> The parts to build your own device mockup: a frame that scales to its box, the hardware picture, and a screen at its real size.

Page: https://gelatinui.com/components/device-frame

## When to use it

Best for: A device mockup of your own, on the same fit, screen, and safe area as the Mockups devices.

- Use it when no device of the Mockups category fits, for example a kiosk or a game handheld.
- Give `box` the body plus the keys that stick out, so a full-width frame never scrolls the page.
- Make the screen corner the body corner minus the bezel, so the corners are concentric.

## When not to use it

- For an iPhone, use the [iPhone](https://gelatinui.com/components/iphone.md).
- For a browser frame, use the [Browser Window](https://gelatinui.com/components/browser-window.md).

## Notes for agents

- `DeviceFrame` writes the geometry as custom properties (`--device-screen-*`, `--device-<finish key>`, `--safe-area-*`). The parts read them, so they need no context.
- Compose `DeviceFrameHardware` (the body picture), then `DeviceFrameDisplay` with `DeviceFrameScreen` first and the system UI parts after it.
- Name your device with `data-part` on each part. Draw the body with `var(--device-<key>)` colors from `finish`.

## Anatomy

```text
DeviceFrame
├─ DeviceFrameHardware (0..n)
├─ DeviceFrameDisplay (0..n)
└─ DeviceFrameScreen (0..n)
```

## API reference

### DeviceFrame

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `box` | `DeviceBox` |  | The figure box in pt: the body plus the keys that stand out of it (`insetBox`). |
| `finish` | `Readonly<Record<string, string>>` |  | The colors of the finish, written as `--device-<key in kebab case>` on the root. |
| `screen` | `DeviceScreenPlace` |  | Where the screen sits on the stage, written as `--device-screen-*` and `--safe-area-*`. |

### DeviceFrameHardware

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `body` | `DeviceBox` |  | The body size in pt, before a turn. |
| `inset` | `DeviceInset` |  | The space the keys take around the body on the stage: the body sits `left` and `top` in. |
| `turn` | `"left" \| "right"` |  | A quarter turn of the body: `left` (`rotate(-90deg)`, the right side goes to the top) or `right` (`rotate(90deg)`). Pair it with `turnInset` for `inset`. |

### DeviceFrameDisplay

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `platform` | `"android" \| "apple" \| "windows"` |  | The platform whose system font the screen and its status bar take (`deviceFontVariants`): app content inside the screen inherits it. Each device sets its own. |

### DeviceFrameScreen

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| DeviceFrame | `device-frame` |  |  |  |
| DeviceFrameHardware | `device-frame-hardware` |  |  |  |
| DeviceFrameDisplay | `device-frame-display` |  |  |  |
| DeviceFrameScreen | `device-frame-screen` |  |  |  |

## Usage

Give the frame the box, the finish, and the screen place, then draw the body.

```tsx title="kiosk-frame.tsx"
import {
  DeviceFrame,
  DeviceFrameDisplay,
  DeviceFrameHardware,
  DeviceFrameScreen,
} from "@/components/mockups/device-frame";

const BODY = { width: 414, height: 868 };
const NO_KEYS = { top: 0, right: 0, bottom: 0, left: 0 };

export function KioskFrame() {
  return (
    <DeviceFrame
      box={BODY}
      finish={{ frame: "#2E2E31" }}
      screen={{
        x: 12,
        y: 12,
        width: 390,
        height: 844,
        radius: 48,
        safeArea: { top: 24, right: 0, bottom: 24, left: 0 },
      }}
      aria-label="Kiosk"
      className="w-72"
    >
      <DeviceFrameHardware body={BODY} inset={NO_KEYS}>
        <span className="absolute inset-0 rounded-[60px] bg-(--device-frame)" />
      </DeviceFrameHardware>
      <DeviceFrameDisplay>
        <DeviceFrameScreen>Your app</DeviceFrameScreen>
      </DeviceFrameDisplay>
    </DeviceFrame>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/device-frame
```

It adds 4 registry items: 4 files, 348 lines, and the npm packages `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [iPhone](https://gelatinui.com/components/iphone.md)
- [iPad](https://gelatinui.com/components/ipad.md)
- [Android Phone](https://gelatinui.com/components/android-phone.md)
- [Apple Watch](https://gelatinui.com/components/apple-watch.md)
- [MacBook](https://gelatinui.com/components/macbook.md)

## Accessibility

`DeviceFrameHardware` is hidden from screen readers. Give the root an `aria-label`, so the figure has a name.
