Components

Device Mockup

Browser and iPhone mockups for React and Tailwind CSS, drawn entirely in CSS and inline SVG with no images. Wrap a screenshot or live components in a Safari window or a phone with a dynamic island; frames scale with container queries and can tilt slightly toward the cursor.

  • Pure CSS & SVG
  • Safari + iPhone frames
  • Container-query scaling
  • Optional 3D tilt
  • prefers-reduced-motion
24.8k
1,204
3.6%

Installation

$ npx shadcn@latest add https://duskui.com/r/device-mockup.json

Usage

product-shot.tsx
import { PhoneMockup, SafariMockup } from "@/components/dusk/device-mockup/device-mockup"

export function ProductShot() {
  return (
    <>
      <SafariMockup url="acme.com" src="/screenshot.png" alt="Acme dashboard" tilt />
      <PhoneMockup className="max-w-[260px]">
        <MobileScreen />
      </PhoneMockup>
    </>
  )
}

Examples

Safari window with tilt

tilt rotates the window a few degrees toward a mouse cursor (pass a number for the max angle). The toolbar drops its navigation buttons when the window is narrow.

Version 2.0

Components for product teams

Hover with a mouse: the window tilts slightly toward the cursor.

Get started

Phone finishes

graphite, silver and mint (a muted sage) frames. Every dimension is a share of the frame's width, so the island, bezel and status bar stay in proportion at any size. Use statusBarClassName to darken the status bar over light screens.

Music
Photos
Wallet

API Reference

Both components accept any <div> attribute. Set the size with className (e.g. max-w-xl).

PropTypeDefaultDescription
childrenReactNode—What appears on the screen: components, a video or an image.
src / altstring—Shortcut for a screenshot. Ignored when children are passed.
tiltboolean | numberfalseTilt toward the cursor on hover (mouse only). true = 4°, or a max angle in degrees.
screenClassNamestring—Classes for the screen area.
urlstring"duskui.com"SafariMockup: text in the address bar.
rationumber16 / 10SafariMockup: screen aspect ratio.
color"graphite" | "silver" | "mint""graphite"PhoneMockup: frame finish.
statusBarbooleantruePhoneMockup: show time, signal and battery over the screen.
timestring"9:41"PhoneMockup: time in the status bar.
statusBarClassNamestring—PhoneMockup: classes for the status bar, e.g. text-black.

Accessibility

  • All frame chrome (toolbar, island, status bar, buttons) is aria-hidden; only your screen content is exposed.
  • Describe screenshots with alt, or pass alt="" when they are decorative.
  • The tilt reacts to a mouse only, never touch, and is disabled with prefers-reduced-motion.
  • Pointer tracking uses motion values, so moving the cursor never re-renders React.