SlideToDetonate

Get this button for GPUI

A slide-to-confirm safety gate that makes you drag a handle across a fuse before the real action detonates.

Preview

Slide to detonate

Props

Install

npx shadcn@latest add @evilbuttons/slide-to-detonate

Usage

import { SlideToDetonate } from "@/components/evil-buttons/slide-to-detonate";

export function ButtonDemo() {
  return (
    <SlideToDetonate onConfirm={() => launchTheMissiles()}>
      Slide to detonate
    </SlideToDetonate>
  );
}

Variants

Light

variant="light" swaps the dark groove for a light one with a white handle.

Slide to detonate

Heavy fuse

High resistance makes the handle lag further behind the pointer the closer it gets to the end.

Push through

Locked to the pointer

smoothness={0} and resistance={0} give a direct, one-to-one drag with no spring.

Slide to detonate

Floaty

High smoothness lets the handle glide behind the pointer on a loose spring.

Slide to detonate

Props

The component spreads native button props onto the handle, except onClick and style.

PropTypeDefaultDescription
childrenReact.ReactNode-Track label shown while idle. Falls back to label.
labelReact.ReactNode"Slide to detonate"Idle label used when no children are provided.
onConfirm() => void-Fired once the handle is released past the threshold.
thresholdnumber0.9Fraction of the track (0-1) the handle must cross to arm the action.
resistancenumber0.35How hard the fuse pushes back (0-1). 0 tracks the pointer one to one; higher values make the handle lag further behind toward the end.
smoothnessnumber0.4How softly the handle follows the pointer (0-1). 0 locks it to the pointer; higher values glide behind on a looser spring.
variant"dark" | "light""dark"Surface style: a recessed dark groove or a light one.
resetAfternumber1600Milliseconds to stay in the success state before resetting. Set to 0 to stay.
disabledbooleanfalseLocks the handle and dims the track.
classNamestring-Extra classes passed to the track.

Good to know

  • A heavy resistance slows the handle but never blocks it.
  • smoothness={0} makes the handle track the pointer exactly.

Search docs

Jump to a button documentation page