Liquid progress
Five liquid treatments: a wave edge, rising bubbles, a tide shimmer, a meniscus drop and a foam line. Each is sized and token-driven, with a value prop.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/progress-liquidDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install motionCopy the source
components/ui/progress-liquid.tsx"use client"
import type * as React from "react"
import { motion, useReducedMotion } from "motion/react"
import { cn } from "@/lib/utils"
/* Liquid progress family: the fill behaves like a liquid level - wave, bubble, tide, meniscus, foam. Colour comes ONLY from tokens (color-mix, oklab). The fill width always lands on value; the continuous wave and bubble motion stops under reduced-motion. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
const track: Record<StyledSize, string> = {
sm: "h-1",
md: "h-1.5",
lg: "h-2.5",
xl: "h-3.5",
}
const trackBase = "relative w-56 max-w-full overflow-hidden rounded-full bg-secondary"
type Props = React.ComponentProps<"div"> & { size?: StyledSize; value?: number; label?: string }
function clamp(v: number) {
return Math.max(0, Math.min(100, v))
}
/* Wave: dolgunun ust kenari salinan bir sinus dalgasi (yatayda kayan SVG). */
export function WaveProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 overflow-hidden rounded-full bg-primary"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
>
<motion.svg
aria-hidden="true"
viewBox="0 0 40 8"
preserveAspectRatio="none"
className="absolute inset-y-0 left-0 h-full w-[200%]"
animate={reduce ? undefined : { x: ["0%", "-50%"] }}
transition={reduce ? undefined : { duration: 1.6, ease: "linear", repeat: Infinity }}
>
<path
d="M0 4 Q5 0 10 4 T20 4 T30 4 T40 4 V8 H0 Z"
fill="color-mix(in oklab, var(--color-primary-foreground) 30%, transparent)"
/>
</motion.svg>
</motion.span>
</div>
)
}
/* Bubble: dolgu icinde yukselen token kabarciklar (deterministik konum/gecikme). */
export function BubbleProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
const bubbles = [
{ left: "18%", delay: 0, dur: 1.7 },
{ left: "42%", delay: 0.5, dur: 2.1 },
{ left: "68%", delay: 0.9, dur: 1.9 },
{ left: "85%", delay: 0.3, dur: 2.3 },
]
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 overflow-hidden rounded-full bg-primary"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
>
{!reduce &&
bubbles.map((b, i) => (
<motion.span
key={i}
aria-hidden="true"
className="absolute bottom-0 size-1 rounded-full bg-[color-mix(in_oklab,var(--color-primary-foreground)_45%,transparent)]"
style={{ left: b.left }}
animate={{ y: ["10%", "-120%"], opacity: [0, 1, 0] }}
transition={{ duration: b.dur, ease: "easeInOut", repeat: Infinity, delay: b.delay }}
/>
))}
</motion.span>
</div>
)
}
/* Tide: sivi seviyesi + ustunde ince yatay token parilti (gel-git shimmer). */
export function TideProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 overflow-hidden rounded-full bg-primary"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
>
<motion.span
aria-hidden="true"
className="absolute inset-0 [background-image:linear-gradient(90deg,transparent,color-mix(in_oklab,var(--color-primary-foreground)_35%,transparent),transparent)] [background-size:60%_100%] bg-no-repeat"
animate={reduce ? undefined : { backgroundPositionX: ["-60%", "160%"] }}
transition={reduce ? undefined : { duration: 2.2, ease: "easeInOut", repeat: Infinity }}
/>
</motion.span>
</div>
)
}
/* Drop: dolgunun ust yuzeyi yuvarlak bir meniskus; hafifce salinir. */
export function DropProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 overflow-hidden rounded-full bg-primary"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
>
<motion.span
aria-hidden="true"
className="absolute inset-x-0 top-0 h-3/5 rounded-full [background-image:radial-gradient(ellipse_at_top,color-mix(in_oklab,var(--color-primary-foreground)_45%,transparent),transparent_70%)]"
animate={reduce ? undefined : { y: ["-6%", "6%", "-6%"] }}
transition={reduce ? undefined : { duration: 2.4, ease: "easeInOut", repeat: Infinity }}
/>
</motion.span>
</div>
)
}
/* Foam: dolgunun ustunde daha acik token kopuk cizgisi; hafifce titrer (wobble). */
export function FoamProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 overflow-hidden rounded-full bg-primary"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
>
<motion.span
aria-hidden="true"
className="absolute inset-x-0 top-0 h-1/3 rounded-full bg-[color-mix(in_oklab,var(--color-primary-foreground)_55%,transparent)]"
animate={reduce ? undefined : { x: ["-8%", "8%", "-8%"], opacity: [0.7, 1, 0.7] }}
transition={reduce ? undefined : { duration: 1.8, ease: "easeInOut", repeat: Infinity }}
/>
</motion.span>
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Wave
The fill has an oscillating wave top edge.
import { WaveProgress } from "@/components/ui/progress-liquid"
<WaveProgress value={60} />Bubble
Token bubbles rise through the fill.
import { BubbleProgress } from "@/components/ui/progress-liquid"
<BubbleProgress value={60} />Tide
A subtle horizontal wave shimmer.
import { TideProgress } from "@/components/ui/progress-liquid"
<TideProgress value={60} />Drop
A rounded meniscus top on the fill.
import { DropProgress } from "@/components/ui/progress-liquid"
<DropProgress value={60} />Foam
A lighter token foam line wobbles on top.
import { FoamProgress } from "@/components/ui/progress-liquid"
<FoamProgress value={60} />ai2 Liquid progress: 5 styled variations on the token system
The ai2 Liquid progress are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around liquid-styled progress. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: framer-motion animates the wave edge, rising bubbles and foam. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, the liquid motion stops and the fill holds at the value.
What is in the ai2 Liquid progress?
5 exports in one file: Wave, Bubble, Tide, Drop and Foam. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: framer-motion animates the wave edge, rising bubbles and foam.
- Reduced-motion aware: Under prefers-reduced-motion, the liquid motion stops and the fill holds at the value.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Liquid progress sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.