Water
Quick, loose, back home in a blink.
Real fluid dynamics on real elements. Your buttons stay buttons: focusable, clickable, read by a screen reader. They are just made of water now.
01 · Accessible
The liquid is painted under the page; the element is untouched. Press Tab to walk through these three and Enter to make a splash. The focus ring is the browser's own.
02 · Pointer
Hover and the liquid swells. Click and it splashes. Move fast across it and it follows your wake.
With WebGPU the labels flow with the liquid, glyph by glyph, and settle back into crisp DOM text.
03 · Materials
Three presets, three instances of the engine, one shake. Viscosity, cohesion and recovery are yours to tune.
Quick, loose, back home in a blink.
Thick and slow; it takes its time.
Springy; it wobbles and holds together.
04 · Drag
Drag one into another. On a phone: hold, then drag.
Drop a pill on this card; they merge, then part when you let go.
One element per call opts out: observe(el, { drag: false }).
05 · Gravity
Gravity leans the liquid; the shape always comes home. On a desktop, turn the dial.
06 · Scroll
A long run of cards. The far ones rest, parked outside the simulation, and appear at rest when you reach them.
07 · Reduced motion
Two identical cards. The right one runs as it would for a visitor who asked for reduced motion: still and crisp, every control still works.
Splashes like the rest of the page.
forceReducedMotion: true
When printed or in forced-colours mode the liquid steps aside and every element shows its own styling.
08 · Install
Vanilla, React or Vue. One instance, any element, no build plugin.
npm install liquiddom@alpha<button data-liquid>Pour me</button>
<script type="module">
import { LiquidDOM } from "liquiddom";
const liquid = await LiquidDOM.create({ autoObserve: true });
</script>import { LiquidProvider, LiquidElement, useLiquidError } from "@liquiddom/react";
function Pills() {
const error = useLiquidError();
return (
<>
<LiquidElement as="button" className="pill">Pour me</LiquidElement>
<LiquidElement as="button" className="pill" drag={false}>I stay put</LiquidElement>
{error !== null ? <p role="status">The liquid stopped.</p> : null}
</>
);
}
export default function App() {
return (
<LiquidProvider config={{ material: { viscosity: 0.6, cohesion: 0.85, recovery: 0.4 } }}>
<Pills />
</LiquidProvider>
);
}// main.ts
import { createApp, defineComponent, h } from "vue";
import { LiquidPlugin, LiquidElement, useLiquidError } from "@liquiddom/vue";
const App = defineComponent({
setup() {
const error = useLiquidError();
return () => [
h(LiquidElement, { as: "button", class: "pill" }, { default: () => "Pour me" }),
h(LiquidElement, { as: "button", class: "pill", drag: false }, { default: () => "I stay put" }),
error.value !== null ? h("p", { role: "status" }, "The liquid stopped.") : null,
];
},
});
createApp(App).use(LiquidPlugin, { material: { viscosity: 0.6 } }).mount("#app");