Liquid Metal Button wraps a React pill button in a WebGL2 shader rim of flowing liquid chrome, with a thin gold and blue fringe on its edges. Hover and press speed up the flow, clicks fire a ripple, and it falls back to a plain CSS rim when WebGL2 is unavailable. Use it for premium CTAs on AI and developer tool landing pages.
Installation
Usage
import { LiquidMetalButton } from "@/components/ui/liquid-metal-button";<LiquidMetalButton onClick={() => console.log("clicked")}>
Get Started
</LiquidMetalButton>Icon-only: make it square and give it a label, since there is no text to read.
<LiquidMetalButton
className="aspect-square w-12 px-0 py-0"
aria-label="Get started"
>
<Sparkles className="size-4" aria-hidden />
</LiquidMetalButton>Tune the metal: more stripes, a wider prism fringe, a little liquid wobble:
<LiquidMetalButton
repetition={6}
shiftRed={0.8}
shiftBlue={0.8}
distortion={0.4}
>
Get Started
</LiquidMetalButton>Set shiftRed and shiftBlue to 0 for plain polished steel with no fringe.
Props
Accepts every standard <button> attribute in addition to the below.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Button content. Text, an icon, or both. |
rimWidth | number | 2 | Thickness of the visible metal rim, in pixels. |
repetition | number | 4 | How many stripes of light fit across the metal. |
softness | number | 0.5 | 0 is a hard edge between light and dark, 1 a smooth gradient. |
shiftRed | number | 0.3 | How far red is pulled ahead of green: the warm side of the prism fringe. |
shiftBlue | number | 0.3 | How far blue is pulled behind green: the cool side of the prism fringe. |
distortion | number | 0 | Noise bending the stripes. 0 keeps them smooth arcs. |
angle | number | 45 | Direction the stripes run and flow, in degrees. |
scale | number | 8 | How far zoomed in. Higher shows a smaller window of the pattern, so broader bands. |
speed | number | 0.6 | Base flow speed. Hover runs at 1.7×, and a press at 4× for 300ms. |
disableRipple | boolean | false | Suppress the click ripple. |
surfaceClassName | string | — | Classes for the inner pill that sits on top of the metal rim. |
className | string | — | Classes for the button itself. |
Related components
- 3D Layered Card
A 3D card with layered effects and animations.
- Animated Code Block
Code snippets with typing and highlighting effects.
- Animated Text
Text with various animation effects and transitions.
- Ascii Text
Renders text as animated ASCII block letters, with wave, scan, glitch, typewriter and pulse modes.
