Surprising Button
A playful button with animated sliding and reveal text. Great for fun micro-interactions and attention-grabbing actions.
Demo
Interactive Demo
Hover over the button to reveal the surprise text.
Ready for a surprise?
You found it!
tsx
Loading...
Installation
Install the required dependencies to get started:
bash
Loading...
Type Integration
Create a lib folder at the root of your project and add a types.ts file with the following interface. This interface is used by all button components for consistent props and TypeScript support.
typescript
Loading...
Usage
Import and use the SurprisingButton component in your Next.js application:
tsx
Loading...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Button content (usually text or icon). |
onClick | () => void | undefined | Click handler for the button. |
className | string | "" | Additional CSS classes for the button. |
disabled | boolean | false | Disables the button if true. |
type | "button" | "submit" | "reset" | "button" | Button type attribute. |
Features
- Animated sliding and reveal text on hover
- Dual border color animation
- Gradient background with smooth transitions
- Customizable label and style
- Framer Motion-powered transitions
- TypeScript support
- Production-ready and accessible
Dependencies
Next.js 15+
Framer Motion
Tailwind CSS (recommended)
TypeScript (recommended)