Liquid button
A button made of liquid metal that reaches for your cursor.
<piix-liquid-button>WebGLForm-readyNew<piix-liquid-button>Get started</piix-liquid-button>
Look
Size
Drawn on the GPU as a smooth signed distance field and shaded as a real material: chrome, glossy ink, clear water or honey, mirroring a studio with a hard horizon line. Its edge breathes; bring the pointer near and a bead of liquid stretches out toward it and joins back when you leave. Click and droplets splash out and fall back in.
Installation
<!-- once, anywhere on the page: every component --> <script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/piixpal.min.js"></script>
<!-- just liquid button (the shared engine loads itself, once) --> <script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/dist/c/liquid-button.min.js"></script>
npm install piixpal // once, in your entry file import "piixpal";
// npm install piixpal
import "piixpal";
export default function Page() {
return (
<piix-liquid-button>Get started</piix-liquid-button>
);
}
Usage
<piix-liquid-button>Get started</piix-liquid-button>
Examples
Looks
<piix-liquid-button>Chrome</piix-liquid-button> <piix-liquid-button look="ink">Ink</piix-liquid-button> <piix-liquid-button look="water">Water</piix-liquid-button> <piix-liquid-button look="honey">Honey</piix-liquid-button>
Your own material
Three colours: the floor it reflects, the bright horizon, the sky.
<piix-liquid-button colors="#0b2a1c,#eafff4,#4fc38a">Mint</piix-liquid-button>
Sizes
<piix-liquid-button size="sm">Small</piix-liquid-button> <piix-liquid-button>Medium</piix-liquid-button> <piix-liquid-button size="lg">Large</piix-liquid-button>
API reference
| Attribute | What it does | Default |
|---|---|---|
look | chrome ink water honey: the liquid's material | chrome |
colors | your own material, three colours: floor, horizon, sky (overrides look) | – |
text | label colour | the look's |
size | sm md lg | md |
type | button submit reset | button |
href | makes it a link | – |
disabled | greyed out, can't be pressed | – |
Events
| Event | When |
|---|---|
click | like any button |
Accessibility
- A real, form-associated button: focusable, Enter and Space press it.
- The liquid is drawn on a canvas hidden from screen readers.
- With reduced motion it holds still.