Components / Mockups
Laptop
Free Mockups React component — LaptopMockupCard. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.
MacBook Pro frame wrapping your screenshot — black lid and bezel with a gray outer frame and base. Pass variant="titanium" for a titanium outer frame and base.
Preview
Setup
How to use
Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.
- 1
Run in your terminal:
$npm install clsx tailwind-merge lucide-react - 2
Copy
lib/cn.tsbelow. Skip if you already havecn(). - 3
Copy the code below and create
components/mockups/laptop-mockup-card.tsxin your project. - 4
Import and render:
Exampleimport { LaptopMockupCard } from "@/components/mockups/laptop-mockup-card";
lib/cn.ts
import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
components/mockups/laptop-mockup-card.tsx
import {forwardRef,type ComponentPropsWithoutRef,type ReactNode,} from "react";import { cn } from "@/lib/cn";const laptopFrameVariants = {gray: {border: "border-neutral-300",base: "bg-linear-to-b from-neutral-300 to-neutral-400",notch: "bg-neutral-500",},titanium: {border: "border-[#7a7671]",base: "bg-linear-to-b from-[#8a8580] to-[#6a6560]",notch: "bg-[#5c5854]",},} as const;type LaptopFrameVariant = keyof typeof laptopFrameVariants;type LaptopMockupCardProps = Readonly<ComponentPropsWithoutRef<"div"> & {variant?: LaptopFrameVariant;children?: ReactNode;}>;export const LaptopMockupCard = forwardRef<HTMLDivElement,LaptopMockupCardProps>(({ className, children, variant = "gray", ...props }, ref) => {const frame = laptopFrameVariants[variant];return (<divref={ref}data-slot="laptop-mockup-card"data-variant={variant}className={cn("flex flex-col items-center font-sans", className)}{...props}><divclassName={cn("w-[280px] overflow-hidden rounded-t-xl border-2 border-b-0 shadow-xl md:w-[384px]",frame.border,)}><div className="bg-neutral-800 p-1.5 pb-0"><div className="relative h-[184px] overflow-hidden rounded-t-[4px] bg-neutral-900 md:h-[252px]"><div className="relative size-full overflow-hidden rounded-t-[4px]">{children}</div></div></div></div><divclassName={cn("relative h-2.5 w-[315px] rounded-b-xl md:h-3 md:w-[432px]",frame.base,)}><divclassName={cn("absolute top-0 left-1/2 h-1 w-14 -translate-x-1/2 rounded-b-md md:w-16",frame.notch,)}aria-hidden="true"/></div></div>);});LaptopMockupCard.displayName = "LaptopMockupCard";