Skip to documentation content

Liquid Metal

Pour a flowing chrome surface into the container or into a circle or rounded rectangle.

liquid-metal-demo

Overview

Liquid Metal renders a mirror-like surface that slowly flows, reflecting a simple studio of bright and dim light bands. Near the band edges a little color separates, the way light does through polished glass or mercury. Fill a whole container for a hero background, or set shape to pour the metal into a circle or rounded rectangle with a transparent outside: the reflections bend along the outline, so the shape reads as a solid, beveled object, which suits a product mark, an avatar ring, or an empty state.

Keep the default near-white colorTint for chrome, or tint it warm for gold and copper finishes. Fewer bands with more softness read as brushed metal; more bands with low softness read as polished chrome.

Installation

npm install honestui

Usage

import { LiquidMetal } from "honestui/shaders"

<div className="h-80 bg-neutral-950">
  <LiquidMetal className="size-full" shape="circle" shapeScale={0.7} />
</div>

With shape="circle" or shape="rounded-rect", everything outside the shape is transparent, so the container's own background shows through.

Accessibility

Liquid Metal is decorative: the canvas is hidden from assistive technology, and any text or action belongs in normal HTML beside or above it. The bright bands move across the whole surface, so test the contrast of overlaid text across the full animation, not one frame. The effect pauses while it is offscreen, while the document is hidden, and when the user prefers reduced motion; a still frame is rendered instead. Use paused for your own control, and give the container a background that stands in when WebGL is unavailable.

API Reference

PropTypeDefaultDescription
colorTintstring"#f4f5f7"Color multiplied into the reflections. Near white reads as chrome; warm tints read as gold or copper.
repetitionnumber4Number of reflected light bands across the surface.
softnessnumber0.25Softness of the band edges, from 0 (mirror sharp) to 1 (brushed).
distortionnumber1How strongly the surface ripples and flows. 0 gives flat, straight bands.
dispersionnumber0.35Color separation along the band edges.
anglenumber70Direction of the reflected bands, in degrees.
speednumber0.6Animation speed. Changing it never makes the surface jump.
shapenone|circle|rounded-rect"none"Fill the container, or pour the metal into a shape with a transparent outside.
shapeScalenumber0.72Size of the shape relative to the container, from 0 to 1.
pausedbooleanfalseRenders a static frame instead of animating.
classNamestring–Class for sizing and positioning the container.