iOS 26 Liquid Glass effect recreated for the web using pure CSS SVG filters.
- ๐จ Pure CSS SVG Filters - Displacement mapping with backdrop-filter
- ๐ฎ Realistic Refraction - Dynamic displacement creates authentic glass distortion
- ๐ Chromatic Aberration - RGB color splitting for that premium glass look
- โก Performant - GPU-accelerated CSS transforms and filters
- ๐ฑ Responsive - Auto-sizing components that scale beautifully
- ๐ Safari Fallback - Automatic graceful degradation with glassmorphism mode
- ๐ฌ Animated Backgrounds - Optional spinning background images with hover control
A versatile container with liquid glass refraction effect. Can be used for cards, panels, hero sections, inline elements, and buttons.
<!-- Basic glass panel -->
<LiquidGlass class="rounded-[50px]" blur={0} chromaticAberration={2}>
<div class="p-8 text-4xl font-bold text-white">
Your content here
</div>
</LiquidGlass>
<!-- Glass with animated background -->
<LiquidGlass
class="rounded-[50px]"
background="/assets/chrome1.png"
blur={0}
chromaticAberration={2}
>
<div class="p-8 text-6xl font-black text-white">
Animated Background
</div>
</LiquidGlass>
<!-- Button style -->
<LiquidGlass class="rounded-[30px]" color="black" chromaticAberration={2} button>
<a href="/link" class="px-8 py-4 text-xl text-white">Click Me</a>
</LiquidGlass>
<!-- Inline usage -->
<p>
This is an
<LiquidGlass class="rounded-full" chromaticAberration={2} button inline>
<span class="px-2 py-0.5 text-sm text-white">inline glass</span>
</LiquidGlass>
element.
</p>| Prop | Type | Default | Description |
|---|---|---|---|
class |
string | โ | CSS classes (use for border-radius, etc.) |
depth |
number | 10 | Edge refraction depth |
strength |
number | 100 | Displacement filter strength |
blur |
number | 0 | Blur amount |
chromaticAberration |
number | 0 | RGB split intensity |
color |
'black' | 'white' | โ | Glass tint color |
background |
string | โ | Background image URL (enables spinning animation) |
freeze |
true | โ | Disable background spin animation |
noMorph |
true | โ | Disable Safari glassmorphism fallback |
button |
true | โ | Enable button styling with hover effects |
inline |
true | โ | Render as inline element (span) |
# Clone the repository
git clone https://github.com/nikdelvin/liquid-glass.git
# Install dependencies
npm install
# Start development server
npm run dev| Browser | Support |
|---|---|
| Chrome 76+ | โ Full |
| Firefox 103+ | โ Full |
| Safari 15+ | |
| Edge 79+ | โ Full |
Safari automatically falls back to a blurred glassmorphism effect when backdrop-filter: url() is not supported.
Background images and textures in /public/assets/:
public/
โโโ assets/
โโโ background.webp # Default background
โโโ chrome1.png, chrome2.png, chrome3.png
โโโ rocks1.png, rocks2.png, rocks3.png
โโโ silk1.png, silk2.png, silk3.png
โโโ lines1.svg, lines2.svg, lines3.svg
โโโ displacement-map-*.png # Displacement textures
โโโ specular-map-*.png # Specular textures
- Astro - Static site generator
- Tailwind CSS - Utility-first CSS
- Anime.js - Animation library for background effects
- SVG Filters - feDisplacementMap, feGaussianBlur, feColorMatrix
- CSS backdrop-filter
MIT ยฉ Nik Delvin
Made with ๐ซง by Nik Delvin
