Liquid Button

A button that fills with liquid from the bottom on hover.

liquid-button.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/liquid-button.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/liquid-button.json

3

Turn on the motion

npx @prequelui/cli@latest animate liquid-button

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

liquid-button.tsx
import { LiquidButton } from "@/components/prequelui/liquid-button";

export default function Demo() {
  return (
    <LiquidButton delay="0.3s" fillHeight="3px">
      Fill me up
    </LiquidButton>
  );
}
import { LiquidButton } from "@/components/prequelui/liquid-button";

export function Variant() {
  return (
    <LiquidButton tempo={1.2}>
      …
    </LiquidButton>
  );
}

Animation

A thin bar rests at the bottom edge. Hovering lets the liquid rise from that edge until it fills the button, while the label flips to the inverse colour; leaving drains it back down the same path.

  • Fill duration: 300 ms on a soft ease-out.
  • At rest the bar keeps a 3 px height so the affordance stays visible.
  • Colour uses the same duration as the fill so text never flashes.
  • Reduced motion keeps the final hover colour without the rising layer.
fill 300 msrest height 3 pxorigin bottominverse label

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

LiquidButton

PropTypeDefault
delaystring"0.3s"
fillHeightstring"3px"
hoverScalenumber1
tapScalenumber0.97
transitionTransitioncomponent spring or tween

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026