Skip to content

nikdelvin/liquid-glass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿซง Liquid Glass

iOS 26 Liquid Glass effect recreated for the web using pure CSS SVG filters.

Demo GitHub

Liquid Glass Preview


โœจ Features

  • ๐ŸŽจ 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

๐Ÿงฉ Components

LiquidGlass

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)

๐Ÿš€ Quick Start

# Clone the repository
git clone https://github.com/nikdelvin/liquid-glass.git

# Install dependencies
npm install

# Start development server
npm run dev

๐ŸŒ Browser Support

Browser Support
Chrome 76+ โœ… Full
Firefox 103+ โœ… Full
Safari 15+ โš ๏ธ Partial (auto-fallback to glassmorphism)
Edge 79+ โœ… Full

Safari automatically falls back to a blurred glassmorphism effect when backdrop-filter: url() is not supported.


๐Ÿ“ Project Assets

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

๐Ÿ› ๏ธ Tech Stack

  • Astro - Static site generator
  • Tailwind CSS - Utility-first CSS
  • Anime.js - Animation library for background effects
  • SVG Filters - feDisplacementMap, feGaussianBlur, feColorMatrix
  • CSS backdrop-filter

๐Ÿ“„ License

MIT ยฉ Nik Delvin


Made with ๐Ÿซง by Nik Delvin

About

๐Ÿซง Pixel-perfect recreation of Apple's iOS 26 Liquid Glass effect using only CSS and SVG filters. Includes LiquidGlass containers, LiquidText, and LiquidButton components.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors