Sora UI

Liquid Metal Button

A button with liquid chrome clipped to its rounded shape and an optional magnetic pointer response, built with typed props instead of data attributes.

Made by Axyl
Loading...

Chrome button with live shader and magnetic settings.

Installation

npx shadcn@latest add @soralabs/liquid-metal-button

File Structure

liquid-metal-button.tsx
defs.ts
metal-runtime.ts
liquid-metal-background.tsx
defs.ts
runtime.ts
shaders.ts

Usage

The chrome is rendered once into an off-screen WebGL2 surface, then copied into a canvas clipped to the button's border radius. Every shader parameter is a typed prop; no data-* attributes are needed. magnetic controls how far the button follows the pointer and can be set to 0 to turn that off. Reduced-motion users get a static surface with no magnetic movement.

For the full-bleed version of the same shader, see Liquid Metal Background.

Props

PropTypeDefault
repetition?
number
1.7
softness?
number
0.1
distortion?
number
0.1
contour?
number
0.5
angle?
number
80
shiftRed?
number
0.35
shiftBlue?
number
0.35
colorBack?
string
"#00000000"
colorTint?
string
"#ffffffff"
magnetic?
number
0.15
className?
string
-
ref?
Ref<HTMLButtonElement>
-

Credits

Inspired by Adam Perlis. Reimplemented for React, Motion and WebGL2.

Built by Axyl. A motion-first component registry for React.

Last updated: 12/1/2026

On this page

Help keep SoraLabs moving.

Every contribution helps us build and maintain open-source tools for the community.

Sponsor on GitHub