Animated React button components

Fuse button

An action button whose done state carries an undo on a burning fuse. Press it and a ghost Undo button appears inside it while its outline burns down. Undo before it burns out, or the action sticks.

Buttons, press, then a timed undo, Motion

Install

npm i clsx lucide-react motion tailwind-merge && curl -o components/fuse-button.tsx https://motion-brew.com/r/fuse-button.tsx

One self contained file for React and Tailwind CSS: fuse-button.tsx. Or ask your AI agent to add it through the MCP server.

Usage

import { Trash2 } from "lucide-react";
import { FuseButton } from "@/components/fuse-button";

export default function Page() {
  return (
    <FuseButton
      icon={<Trash2 className="size-4" />}
      doneLabel="Deleted"
      radius={22}
      onCommit={() => hideRow(id)}
      onUndo={() => showRow(id)}
    >
      Delete
    </FuseButton>
  );
}

With `commitOn="press"` (the default), apply the change optimistically in `onCommit` and reverse it in `onUndo`. With `commitOn="fuse"`, `onCommit` only fires once the fuse runs out.

Props

PropTypeDefaultDescription
childrenReactNode"Archive"Action label
iconReactNodearchive iconIcon before the label, null for none
doneLabelReactNode"Archived"Shown with a check once the fuse runs out
undoLabelReactNode"Undo"Undo button label
size"sm" \"md" \"lg""md"Height and padding
radiusnumberfully roundedCorner radius, px
textColorstringnear-blackAny CSS color
backgroundstringwhiteAny CSS color
fuseColorstring"#f5a524"Fuse and embers
durationnumber4000Undo window, ms
fuseThicknessnumber2.5Fuse stroke, px
crossfadenumber320State swap length, ms
commitOn"press" \"fuse""press"When onCommit fires
afterFuse"reset" \"stay""reset"Back to the action, or stay done
resetAfternumber1600Done state length before a reset, ms
pauseOnHoverbooleanfalsePause the fuse under the pointer
onCommit() => voidThe action applies
onUndo() => voidUndo pressed in time
disabledbooleanDisables the action

More buttons

  • Magnetic button: A button that leans toward your cursor on a spring.
  • Hold to confirm: Hold to fill, let go to cancel.
  • Bell toggle: A pill toggle where a press rings the bell, crossfades the label and unfurls the pill.
  • Slide commit: Slide to confirm: drag the handle past the line and it commits with a spinner and a green check; let go early and it springs home.

All animated react button components