Buttons
Flip Button
Animated flip button with customizable text and transitions. Perfect for React applications requiring interactive buttons with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/flip-button.json
npx shadcn@latest add https://www.shadcn.io/registry/flip-button.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/flip-button.json
bunx shadcn@latest add https://www.shadcn.io/registry/flip-button.json
Features
- Smooth flip animations with configurable spring transitions and 3D perspective effects
- Four flip directions supporting top, bottom, left, and right orientations using Motion
- Customizable styling with separate front and back text appearance options
- TypeScript support with complete interface definitions for all props
- shadcn/ui integration using design tokens and className merging utilities
- Interactive feedback with hover states and tap animations for enhanced UX
Examples
Flip Direction Variants
Different flip directions create unique visual effects when users hover over the button.
Use Cases
This free open source React component works well for:
- Call-to-action buttons - Interactive buttons that reveal secondary actions in Next.js applications
- Navigation menus - Hover effects that show additional context using TypeScript and Tailwind CSS
- Form submissions - Buttons that flip to show loading or success states
- Creative interfaces - Engaging micro-interactions for modern web applications
API Reference
FlipButton
Prop | Type | Default | Description |
---|---|---|---|
frontText | string | required | Text displayed on the front face of the button |
backText | string | required | Text displayed on the back face during flip animation |
from | FlipDirection | "top" | Direction of the flip animation (top, bottom, left, right) |
transition | Transition | { type: "spring", stiffness: 280, damping: 20 } | Motion transition configuration for animation timing |
frontClassName | string | - | Custom CSS classes for the front face styling |
backClassName | string | - | Custom CSS classes for the back face styling |
className | string | - | CSS classes applied to the button container |
FlipDirection
top
- Flips vertically from top to bottombottom
- Flips vertically from bottom to topleft
- Flips horizontally from left to rightright
- Flips horizontally from right to left
Implementation Notes
- Button uses CSS perspective for 3D flip effects with 1000px depth
- Front face has muted background, back face uses primary theme colors
- Invisible text element maintains consistent button dimensions
- Compatible with all Motion transition configurations
- Supports all standard button props through HTMLMotionProps
Copy Button
Animated copy button with visual feedback and state management. Perfect for React applications requiring clipboard functionality with Next.js integration and TypeScript support.
GitHub Stars Button
Interactive GitHub stars button with real-time star count, animated number transitions, and particle effects. Perfect for React applications requiring social proof elements with Next.js integration and TypeScript support.