Tools· Design & Creative

    liquid-glass-js

    Open source vanilla JavaScript library for WebGL-based glass effects in the style of Apple's Liquid Glass, delivering genuine multi-layer light refraction instead of CSS blur for buttons and containers.

    generatingdesigningexecutableOpen Source

    Description

    Strengths

    Genuine WebGL refraction
    Multi-layer calculation across edge, rim, and base surface, complemented by an adaptive Gaussian blur, instead of a plain blur filter.
    Three shape types
    Rounded rectangle, circle, and pill; the pill sizes itself automatically to its text content, the circle follows a set size value, and the overall display adapts to the viewport.
    Nested glass system
    Child elements of a container sample its already rendered output, for stacked glass surfaces instead of isolated effects.
    Centrally controllable parameters
    A global control object bundles edge intensity, rim intensity, blur radius, and tint opacity; through the Container class's instance list, all active glass elements can be updated together.
    Zero dependencies, no build step
    Pure JavaScript to copy directly into the project, with html2canvas as the only external dependency, used for page capture.

    Assessment

    AI features

    • Compact, open source code The library consists of a handful of small files, the Container class, the Button class, and the associated stylesheets, with no build toolchain in between, which makes it easy for AI coding assistants to read the full source and extend it in the same style.

    Suitable for

    • Frontend projects that want a genuine Liquid Glass effect with real light refraction for buttons, containers, or cards, instead of a plain CSS blur filter
    • Vanilla JS or React projects that want to copy the components as their own source code into the repository instead of adding another npm dependency
    • Projects with a deliberate, sparing use of a few glass elements per view, such as a hero CTA or a featured pricing card
    • Less suitable for Less suitable for environments with a strict Content Security Policy that has not been adjusted for external script sources, or for pages that want to use many glass elements at once, where frame rate drops noticeably

    Limitations and notes

    • No npm package Integration happens by copying the source files rather than through a package manager; an npm release is not available yet.
    • Dependency on html2canvas via CDN The page capture that the refraction relies on runs through a CDN inclusion by default; a strict Content Security Policy blocks this unless the file is hosted locally and allowed in script-src.
    • Browser requirements WebGL 2.0, ES6+ JavaScript, and the HTML5 Canvas API must be supported in the target browser.
    • Vanilla JavaScript base Using the library in React requires manual wrapping through useRef and useEffect; no official React component exists.
    • Performance with multiple instances Because every glass instance requires WebGL rendering and a page capture, frame rate drops noticeably when many glass elements are active on a page at the same time.

    Quick start

    1. Copy the core files, the Container class, the Button class, and the associated stylesheets, from the repository into your own project.
    2. Include html2canvas via CDN or locally, since the library needs this dependency for page capture.
    3. Include the script files with a script tag and link the stylesheets.
    4. Create a first glass component, for example a button with text, a shape type, and a click handler, and add it to the document.
    5. Add multiple buttons to a container if needed, to use the nested glass system.

    Tips

    • Set the matching attribute for each of the three shape types: the circle determines its size through the size parameter, the pill sizes itself automatically to its text content.
    • Adjust the global glass parameters centrally through the control object instead of configuring each instance individually.
    • Under a strict Content Security Policy, do not load html2canvas from a public CDN; host the file locally and allow it in script-src instead.
    • Because of the WebGL and page-capture load per view, keep only a few glass elements active at the same time.
    • For use in a React application, wrap the components with useRef and useEffect and remove the created element again on unmount.

    Access

    Last reviewed: · Pricing, plans and features are a snapshot in time. Check the provider's own page before deciding.

    In the workshop this becomes your method.

    Whoever sees this process run once wants the agent behind it next. We build that in the workshop From Process to Agent.

    View workshops

    Related resources

    Browse all resources

    Conversation, not pitch

    Understand first, then decide. We take time for an initial conversation, without sales pressure, without obligation.

    Schedule a call