Drop-in Apple / Figma "Liquid Glass" for the web.
The only liquid-glass tool that lets you switch the rendering engine (pure CSS · SVG displacement · cross-browser clone · WebGL), apply it to any element/shape, and use it from vanilla JS, a web component, or React — with zero dependencies.
🎛️ Try the generator → — tune it visually and copy the code in any framework.
npm i glasskit-jsnpm:
glasskit-js· global:Glasskit· web component:<glass-kit>
<!-- vanilla / CDN -->
<script src="https://unpkg.com/glasskit-js"></script>
<script>
const g = Glasskit.apply(document.querySelector('#card'), {
mode: 'auto', frost: 8, refraction: 90, dispersion: 0.5
});
g.update({ frost: 12 }); // hot-update · g.destroy();
</script><!-- web component (registered automatically) -->
<glass-kit mode="auto" refraction="90" dispersion="0.5"
style="width:340px;height:210px;border-radius:30px">Glass</glass-kit>// React
import Glass from 'glasskit-js/react';
<Glass as="button" mode="auto" refraction={90} dispersion={0.5}
style={{ borderRadius: 999, padding: '14px 28px' }}>Get tickets</Glass>| Mode | Real refraction | Browsers | Refracts | Best for |
|---|---|---|---|---|
css |
✗ (blur) | all | live backdrop | default product UI, mobile, Safari/FF |
svg |
✓ | Chromium | live backdrop | the "wow" surface on Chrome/Edge |
svg-clone |
✓ | all | a cloned DOM element | cross-browser refraction over DOM |
webgl |
✓ | all | an img/canvas/video | hero over a fixed background/video |
auto |
— | — | — | Chromium→svg, else svg-clone if background set, else css |
svg-clone is the cross-browser trick: Safari/Firefox don't allow an SVG filter in
backdrop-filter, so it clones the background element and filters the clone instead.
It refracts DOM, not <canvas> pixels — use webgl for canvas/video backgrounds.
| Figma slider | Option | Optical extras | Option | |
|---|---|---|---|---|
| Frost | frost |
curvature (sphere→squircle) | curvature |
|
| Refraction | refraction |
convex↔concave | convexity |
|
| Depth | depth |
tint | tint, tintOpacity |
|
| Dispersion | dispersion |
corner radius | radius |
|
| Splay | splay |
face gloss | sheen, sheenColor, sheenAngle |
|
| Light (angle / %) | lightAngle / lightIntensity |
drop shadow | shadow |
tinttakes either"r,g,b"(paired withtintOpacity) or a full CSS gradient —tint="linear-gradient(180deg, rgba(255,255,255,.2), rgba(19,19,19,.22))".sheenis the diagonal face gloss (0= off).sheenColortakes"r,g,b"or any CSS color (rgb()/rgba()/hsl()/hex/named).sheenAnglerotates the gloss in degrees; omit it (ornull) to followlightAngle.radiussetsborder-radiuson the element and the refraction map —radius={999}alone gives you a pill; no need to also set it instyle.shadowis any CSSbox-shadow("none"removes it); the inner light border/bezel followlightIntensity.
Any rounded rectangle (incl. pills & circles) works with zero extra code — a
ResizeObserver regenerates the refraction map on resize. Arbitrary outlines (blobs,
SVG paths) keep the blur/tint/highlight via clip-path, but refraction edges assume a
rounded box; supply a custom displacement map for true custom outlines.
Built something with it, or want to hack on the engine, generator, or benchmark? See CONTRIBUTING.md.
MIT — see LICENSE.