Join the Discord!
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

Loading component...

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

Loading component...

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

PropTypeDefaultDescription
frontTextstringrequiredText displayed on the front face of the button
backTextstringrequiredText displayed on the back face during flip animation
fromFlipDirection"top"Direction of the flip animation (top, bottom, left, right)
transitionTransition{ type: "spring", stiffness: 280, damping: 20 }Motion transition configuration for animation timing
frontClassNamestring-Custom CSS classes for the front face styling
backClassNamestring-Custom CSS classes for the back face styling
classNamestring-CSS classes applied to the button container

FlipDirection

  • top - Flips vertically from top to bottom
  • bottom - Flips vertically from bottom to top
  • left - Flips horizontally from left to right
  • right - 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