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-laptopAdds 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.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | None | Screen content, laid out at resolution CSS pixels wide and scaled to fit. It mounts only while the lid is open and still. |
open | boolean | true | Whether the lid is up. Changing it opens or closes the lid. |
finish | 'black' | 'silver' | 'black' | Case colour. |
resolution | number | 1728 | Width in CSS pixels the content is laid out at before it is scaled to the screen. |
glare | boolean | true | A 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.