Kinetic UI
Back to Introduction
Media

CSS Device Mockup

A fully interactive, 3D rotating smartphone frame built entirely out of CSS and Framer Motion—no WebGL required.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add css-device-mockup
CSS Device Mockup

Pure CSS Device Mockup

Move your mouse around to rotate the 3D device. The screen is a real React container.

Kinetic UI Mobile

Welcome to the future of mobile interfaces.

Hero Section
Footer

Installation

npx kinetic-ui-cli@latest add css-device-mockup

How It Works

Traditionally, high-fidelity 3D device mockups require heavy libraries like three.js. The CssDeviceMockup component bypasses this by stacking layers of CSS divs with translate-z offsets and preserve-3d wrappers. It dynamically tracks the mouse pointer to rotate the entire chassis using framer-motion springs. Best of all, because it's just CSS, you can pass standard React children directly into the screen container and they remain fully interactive!

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { CssDeviceMockup } from "@/components/creative/css-device-mockup";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { CssDeviceMockup } from "@/components/creative/css-device-mockup";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <CssDeviceMockup
        mockupWidth{10}
      >
        <div>Content goes here</div>
      </CssDeviceMockup>
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.