Browse docsLaptop

Mockups

Glass Laptop

A CSS 3D laptop mockup whose screen shows your screenshot or React content.

Preview

Demos ready. Update 0.

Installation

For React 19+ apps with Tailwind CSS 4.

npx shadcn@4.14.1 add @glassyui/glass-laptop

Adds 2 files to components/glassyui and installs clsx.

Usage

Usage

import { GlassLaptop } from "@/components/glassyui/glass-laptop";

export function Showcase() {
  return (
    <GlassLaptop
      aria-label="The app on a laptop"
      className="w-full max-w-5xl"
    >
      <img alt="" className="size-full object-cover" src="/app.png" />
    </GlassLaptop>
  );
}

Examples

Open the lid when the page loads

const [open, setOpen] = useState(false);

useEffect(() => {
  const frame = requestAnimationFrame(() => setOpen(true));

  return () => cancelAnimationFrame(frame);
}, []);

return (
  <GlassLaptop open={open} finish="silver">
    <YourScreen />
  </GlassLaptop>
);

API reference

GlassLaptop

A figure that draws the laptop. Its children fill the screen.

PropTypeDefaultDescription
childrenReactNodeNoneScreen content, laid out at resolution CSS pixels wide and scaled to fit. It mounts only while the lid is open and still.
openbooleantrueWhether the lid is up. Changing it opens or closes the lid.
finish'black' | 'silver''black'Case colour.
resolutionnumber1728Width in CSS pixels the content is laid out at before it is scaled to the screen.
glarebooleantrueA faint reflection across the screen. Turn it off for flat screenshots.

Also accepts HTML figure attributes.

Types
GlassLaptopPropsGlassLaptopFinish
Accessibility
Give the figure an aria-label that says what the screen shows, and mark display-only screen content inert.