MCPcopy
hub / github.com/rdev/liquid-glass-react

github.com/rdev/liquid-glass-react @main sqlite

repository ↗ · DeepWiki ↗
26 symbols 49 edges 10 files 0 documented · 0%
README

Liquid Glass React

Apple's Liquid Glass effect for React.

Card Example Button Example

🎬 Demo

Click here to see it in action!

project liquid gif

✨ Features

  • Proper edgy bending and refraction
  • Multiple refraction modes
  • Configurable frosty level
  • Supports arbitrary child elements
  • Configurable paddings
  • Correct hover and click effects
  • Edges and highlights take on the underlying light like Apple's does
  • Configurable chromatic aberration
  • Configurable elasticity, to mimic Apple's "liquid" feel

⚠️ NOTE: Safari and Firefox only partially support the effect (displacement will not be visible)

🚀 Usage

Installation

npm install liquid-glass-react

Basic Usage

import LiquidGlass from 'liquid-glass-react'

function App() {
  return (
    <LiquidGlass>



        <h2>Your content here</h2>


This will have the liquid glass effect





    </LiquidGlass>
  )
}

Button Example

<LiquidGlass
  displacementScale={64}
  blurAmount={0.1}
  saturation={130}
  aberrationIntensity={2}
  elasticity={0.35}
  cornerRadius={100}
  padding="8px 16px"
  onClick={() => console.log('Button clicked!')}
>
  <span className="text-white font-medium">Click Me</span>
</LiquidGlass>

Mouse Container Example

When you want the glass effect to respond to mouse movement over a larger area (like a parent container), use the mouseContainer prop:

function App() {
  const containerRef = useRef<HTMLDivElement>(null)

  return (



      <LiquidGlass
        mouseContainer={containerRef}
        elasticity={0.3}
        style={{ position: 'fixed', top: '50%', left: '50%' }}
      >



          <h2>Glass responds to mouse anywhere in the container</h2>



      </LiquidGlass>



  )
}

Props

Prop Type Default Description
children React.ReactNode - The content to render inside the glass container
displacementScale number 70 Controls the intensity of the displacement effect
blurAmount number 0.0625 Controls the blur/frosting level
saturation number 140 Controls color saturation of the glass effect
aberrationIntensity number 2 Controls chromatic aberration intensity
elasticity number 0.15 Controls the "liquid" elastic feel (0 = rigid, higher = more elastic)
cornerRadius number 999 Border radius in pixels
className string "" Additional CSS classes
padding string - CSS padding value
style React.CSSProperties - Additional inline styles
overLight boolean false Whether the glass is over a light background
onClick () => void - Click handler
mouseContainer React.RefObject<HTMLElement \| null> \| null null Container element to track mouse movement on (defaults to the glass component itself)
mode "standard" \| "polar" \| "prominent" \| "shader" "standard" Refraction mode for different visual effects. shader is the most accurate but not the most stable.
globalMousePos { x: number; y: number } - Global mouse position coordinates for manual control
mouseOffset { x: number; y: number } - Mouse position offset for fine-tuning positioning

Extension points exported contracts — how you extend this code

Vec2 (Interface)
(no doc)
src/shader-utils.ts
LiquidGlassProps (Interface)
(no doc)
src/index.tsx
ShaderOptions (Interface)
(no doc)
src/shader-utils.ts

Core symbols most depended-on inside this repo

createBuildConfig
called by 3
esbuild.config.js
smoothStep
called by 2
src/shader-utils.ts
buildAll
called by 1
esbuild.config.js
watch
called by 1
esbuild.config.js
length
called by 1
src/shader-utils.ts
roundedRectSDF
called by 1
src/shader-utils.ts
texture
called by 1
src/shader-utils.ts
updateShader
called by 1
src/shader-utils.ts

Shape

Function 17
Method 4
Interface 3
Class 2

Languages

TypeScript100%

Modules by API surface

src/shader-utils.ts12 symbols
src/index.tsx6 symbols
esbuild.config.js3 symbols
liquid-glass-example/src/pages/index.tsx2 symbols
liquid-glass-example/src/pages/api/hello.ts1 symbols
liquid-glass-example/src/pages/_document.tsx1 symbols
liquid-glass-example/src/pages/_app.tsx1 symbols

Dependencies from manifests, versioned

@biomejs/biome1.9.4 · 1×
@types/node20 · 1×
@types/react18.2.0 · 1×
@types/react-dom18.2.0 · 1×
esbuild0.19.0 · 1×
liquid-glass-react1.0.2 · 1×
lucide-react0.514.0 · 1×
next15.3.3 · 1×
react18.2.0 · 1×
react-dom18.2.0 · 1×
tailwindcss4 · 1×

For agents

$ claude mcp add liquid-glass-react \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact