Skip to content

Flip Button

Button whose label leaves at the top while a copy rises from below.

From the Findit template — see it in context
Book a viewing

Installation

$ npx shadcn@latest add https://framebrick.co/r/flip-button.json

Usage

import { FlipButton } from "@/components/ui/flip-button";

<FlipButton href="/contact">Book a viewing</FlipButton>
<FlipButton variant="outline" pill onClick={save}>Save</FlipButton>

Props

PropTypeDefaultDescription
variant"default" | "secondary" | "outline" | "ghost""default"shadcn button styles.
size"sm" | "default" | "lg""default"Height 32 / 36 / 40 px, like the shadcn button.
pillbooleanfalseFully round corners, as in the template.
hrefstring—Render a Next.js link instead of a button. http(s) links open in a new tab.
…propsbutton / anchor props—Passed to the element (onClick, disabled, aria-*, Motion props).
  • The second copy of the label is aria-hidden, so a screen reader reads the label once.
  • The flip also runs on keyboard focus.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS + Motion (motion/react) component called FlipButton.
- Look like the shadcn/ui Button: rounded-md (or rounded-full with a "pill" prop), text-sm font-medium, variants
  default / secondary / outline / ghost, sizes sm (h-8 px-3), default (h-9 px-4), lg (h-10 px-6),
  focus ring ring-[3px] ring-ring/50.
- The label sits in a box one line tall (h-5) with overflow-hidden, holding a column of two identical labels 8px apart.
- On hover and on keyboard focus the column moves up 28px with a spring (bounce 0, duration 0.4s): the first label
  leaves at the top while the copy arrives from below. The copy is aria-hidden.
- If an href prop is given render a Next.js Link (motion.create(Link)); external http(s) links get target _blank and
  rel noopener noreferrer.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy