Controls

Spring Button

A button that sinks when touched and comes back with weight, squashing with its speed.

Preview

Installation

Terminal
npx @usefluid/cli add spring-button

Usage

SpringButton.tsx
import { SpringButton } from "./SpringButton";

<SpringButton onClick={save}>Save</SpringButton>
<SpringButton variant="quiet" onClick={cancel}>Cancel</SpringButton>

API reference

PropTypeDefaultDescription
variant"solid" | "quiet""solid"Main or secondary action.
pressedboolean—Show it held down, for showcases.
...button propsButtonHTMLAttributes—Everything a native button takes: onClick, type, disabled, aria-*.

Keyboard and screen readers

A plain button with a visible focus ring.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

A spring takes the scale from 1 to 0.93 on press and back on release. The speed of that spring squashes the button along the movement, which is why it feels like it has mass. It works with touch, mouse and keyboard.

For your agent

For your agent

Add Spring Button to my project with the Fluid library. Replace the main buttons with SpringButton, keeping the actions they already have. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.