Animated MacBook

Pro

A closed MacBook that hinges open and powers on when you hover, in ten finishes.

css 3d3dillustrationmacbooklaptopdevicecsshover
Animated MacBook component preview

Overview

Animated MacBook is a React and Tailwind CSS laptop mockup that opens when hovered, in Next.js or any React app. It is pure CSS 3D with no dependencies: a full keyboard with function row and Touch ID, a notched display showing your screenshot, and a glass trackpad. Hover swings the lid up, tilts the deck toward the viewer, and powers on the screen. Ten finishes, hinge angle, and view tilt are props, and it scales with its container. Reduced motion shows it already open, and touch screens have no hover, so set position to open on mobile.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add macbook

Usage

Import Macbook from @/components/wensity/macbook and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { Macbook } from "@/components/wensity/macbook";
export default function Example() {
return (
<Macbook
theme="space-black"
position="hover"
src="/screenshot.webp"
className="w-full max-w-lg"
/>
);
}

Props

PropTypeDefaultDescription
theme"space-black" | "black" | "midnight" | "space-gray" | "silver" | "starlight" | "sky-blue" | "gold" | "yellow" | "wensity-red""space-black"Chassis finish: Space Black, Black, Midnight, Space Gray, Silver, Starlight, Sky Blue, Gold, Yellow, or Wensity Red.
position"hover" | "open" | "closed""hover"Pose: hover to open, stay open, or stay closed.
openAnglenumber138Lid hinge angle in degrees (90 ≈ upright, 180 ≈ folded flat back). Larger reclines the screen further.
baseTiltnumber16Tilt of the bottom body / keyboard deck toward the viewer, in degrees. Independent of the lid.
tiltnumber6Overall camera/view tilt of the open deck in degrees. Lower reads head-on, higher tips toward a top-down view.
srcstring-Image shown on the screen (fills the display, object-cover).
screenAltstring"Screen"Alt text for the screen image.
labelstring"MacBook illustration"Accessible label announced for the illustration.

Featured in React 3D components.