Liquid Loading Animation
ProA loader that fills with liquid to your progress, in a glass circle, square, or word.
Overview
Liquid Loading Animation is a React and Tailwind CSS liquid loader that fills a glass circle, rounded square, or any word with water, in Next.js or any React app. Pass value from 0 to 100 and the level rises on a critically damped spring without overshoot, while the waves swell as it moves and calm once it stops. Omit value for an indeterminate loop. The percentage turns white where liquid covers it. It is one SVG with progressbar ARIA, paused off screen and still under reduced motion. The text shape uses the inherited font family, so pick a bold one.
Installation
Run the following command
pnpm dlx wensity@latest add liquid-loading-animation
Usage
Import LiquidLoadingAnimation from @/components/wensity/liquid-loading-animation and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.
import { LiquidLoadingAnimation } from "@/components/wensity/liquid-loading-animation";export default function Example({ progress }: { progress: number }) {return (<div className="flex flex-col items-center gap-8"><LiquidLoadingAnimation value={progress} label="Uploading file" /><LiquidLoadingAnimation shape="text" text="Loading" /></div>);}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | - | Progress from 0 to 100. Omit it for an indeterminate loader that drifts up and down. |
shape | "circle" | "square" | "text" | "path" | "circle" | Container the liquid fills: a glass circle, a glass rounded square, the letters of a word, or an SVG path. |
text | string | "Loading" | The word whose letters fill up when shape is text. |
path | string | - | SVG path data to fill when shape is path. The box is measured from the path itself. |
color | string | "#2f7bff" | Liquid color, any CSS color. |
labelColor | string | "#ffffff" | Color of the percentage where the liquid covers it. |
wave | number | 0.5 | Wave height, from 0 for a flat surface to 1. |
speed | number | 1 | Playback rate of the waves, bubbles, and indeterminate loop. |
bubbles | boolean | true | Bubbles rising through the liquid. |
showValue | boolean | - | Shows the percentage. On by default for circle and square. |
formatValue | (percent: number) => string | - | Formats the label. Receives a whole number from 0 to 100. |
label | string | "Loading" | Accessible name of the loader. |
