Components/Buttons

Drag Button

An interactive draggable button requiring a left-to-right swipe to confirm actions, featuring optional success animations and spring physics.

buttondragswipemotion

Preview

Installation

npx shadcn@latest add https://grootstudio.vercel.app/r/drag-button.json

Usage

Props

PropTypeDefaultRequiredDescription
childrenReactNodeundefinedThe content to display inside the button.
onDragComplete() => voidundefinedCallback triggered when the handle reaches the end of the button.
showConfirmationbooleantrueWhether to show the success animation after a successful drag.
successIconReactNode<Check />Custom icon to show during the success animation.
variant'default' | 'outline''default'The visual style of the button.
classNamestringundefinedOptional class names for custom styling.

Dependencies

motion/react
lucide-react