"use client"
import confetti from "canvas-confetti"
import { SwipeButton } from "@/components/ui/swipe-button"
export function SwipeButtonDemo() {
const triggerConfetti = () => {
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 },
})
}
return (
<div>
<SwipeButton onSwipeComplete={triggerConfetti} />
</div>
)
}
pnpm dlx shadcn@latest add https://badtz-ui.com/r/swipe-button.json
import { SwipeButton } from "@/components/ui/swipe-button";
<SwipeButton>Swipe to validate</SwipeButton>
SwipeButton
props.
Prop | Type | Default |
---|---|---|
text? | string | "Swipe to validate" |
onSwipeComplete? | () => void | - |
gap? | number | 3 |
validationDuration? | number | 2000 |
className? | string | - |
On This Page