Skip to content

Flip Button

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

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

From the Findit template, see it in context.

Book a viewing

Examples

With arrow

An arrow after the label that nudges to the right as the label rolls.

<FlipButton href="/contact" arrow>Book a viewing</FlipButton>
<FlipButton href="/listings" arrow variant="outline">All listings</FlipButton>

Turning arrow

The label rolls while an up-right arrow turns 45° to point right, on a spring with a little bounce.

<FlipButton href="/contact" arrow="turn" pill>Contact us</FlipButton>
<FlipButton href="/projects" arrow="turn" pill variant="outline">Our projects</FlipButton>

Sliding arrow

The label rolls while the arrow leaves to the right and a copy of it comes in from the left.

<FlipButton href="/contact" arrow="slide">Book a session</FlipButton>
<FlipButton href="/service" arrow="slide" variant="outline">Explore programs</FlipButton>

Side flip

The label leaves to the right while its copy comes in from the left.

<FlipButton href="/book" direction="right">Book an appointment</FlipButton>

Icon box

A square with an icon at the end: its cover rolls with the label.

<FlipButton href="/book" iconBox={<ArrowUpRight />}>Book now</FlipButton>
// an icon-only button needs a name
<FlipButton href="/book" variant="outline" iconBox={<ArrowUpRight />} aria-label="Open the booking page" />

Letters

Pointing at a link writes its label again, letter by letter.

<FlipButton href="/services" variant="ghost" size="sm" by="letter">Services</FlipButton>

Face flip

The whole face rolls: the fill, the line and the label leave together and another face takes their place.

<FlipButton href="/viewings" face="secondary">Book a viewing</FlipButton>
<FlipButton href="/homes" variant="outline" face="default">See all homes</FlipButton>

Blur

The label that leaves blurs while the one that arrives sharpens.

<FlipButton href="/contact" blur={2}>Book a call</FlipButton>
// a stronger blur: blur={5}

Ring

The label rolls while an 8 px ring shrinks to 4 px and fills.

<FlipButton href="/contact" dot="ring">Let's talk</FlipButton>
// the same dot, grown instead: a 6 px dot at 60% that grows to 8 px and turns solid
<FlipButton href="/contact" dot="grow">Let's talk</FlipButton>

Growing dot

The label rolls while a 6 px dot grows to 8 px and turns solid.

<FlipButton href="/services" dot="grow" variant="outline">Our services</FlipButton>

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.
arrowboolean | "nudge" | "turn" | "slide"falseAn arrow after the label. true or "nudge" nudges it 5 px to the right as the label rolls (Semono); "turn" points it up-right and turns it 45° to point right, on a spring with a little bounce (Compose Digi, Lookis, Catchup); "slide" sends it out to the right while a copy of it comes in from the left (Metuo).
dot"ring" | "grow"—A small dot after the label, instead of an arrow (ignored with one). "ring" is an 8 px ring that shrinks to 4 px and fills (Cerette); "grow" is a 6 px dot at 60% that grows to 8 px and turns solid (Kalme). Decoration only: aria-hidden, drawn in the label colour.
direction"up" | "right""up"Which way the label goes: up (the roll), or right: it leaves to the right while its copy comes in from the left (KorDent). face ignores it; it combines with arrow, dot and blur.
iconBoxReactNode—An icon in a 28 px square at the end of the button (KorDent). The square holds two covers: the one you see leaves to the right and the other comes in from the left as the label rolls, while the icon stays and takes the other cover's colour. Without children the square is the whole button, so give it an aria-label. arrow and dot are ignored with it.
by"label" | "letter""label"With letter, hover writes the label again letter by letter, each rising from 10 px below and fading in 0.075 s after the one before; leaving brings it back from 10 px above (the menu links of KorDent). The label must be plain text. direction and blur are ignored with it.
face"default" | "secondary" | "outline" | "ghost"—The whole face rolls, not only the label: the face of this variant rises to replace the resting one (variant), taking its fill, its line and its label with it (Goeboek). arrow, dot and blur are ignored with it.
blurnumber0Blur in px while the label rolls: the label that leaves goes from 0 to this, the copy that arrives from this to 0. Balancee uses 2, Kalme 5. 0 leaves the button exactly as it was.
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).
  • direction, iconBox and by are KorDent's: every one of its buttons is one of these, in eight variants. direction="right": a strip of two copies 10 px apart slides from the right edge to the left in Framer, on spring 500 / 60; here each copy moves its own width on the component's own spring and the window clips them, so the gap is not needed. It works on keyboard focus too, which KorDent's own port does not. iconBox: the square holds a strip of two covers twice its width that moves half of itself, with the label, while the icon stays on top; each variant has its own two covers and two icon colours from the theme's pairs (3:1 or better for the icon on its cover, measured in the four sample themes). The icon is decoration (aria-hidden): a button with only the icon needs an aria-label. by="letter": one aria-hidden span per character over an invisible copy that carries the text, so the label is read once; nothing moves before the first hover; a mouse or the keyboard focus starts it, not a touch. Reduced motion: the letters fade without rising (motion-reduce:transform-none!, which beats the inline transform, so the markup never depends on the preference). direction and blur do not combine with letter, and iconBox ignores arrow and dot, both at the end of the button: the ignored ones are not drawn.
  • face is Goeboek's Button/Secondary and filter chips: a block two faces tall holds the resting face over the one that takes its place, and on hover and focus it rises one face (measured 26 px at 100 ms, 43.8 at 250, 48.1 at 450 and 48.8 at 800 for a 48.8 px face, on spring 500 / 60). The component's own bounce-0, 0.4 s spring does it, one spring for the whole button. The distance is one face, so every size works. Each face carries its own fill with no hover fade, and the second is aria-hidden, so the label is read once; both faces keep 4.5:1 over their own fill. arrow, dot and blur are ignored with face: they would roll with it and say the same thing twice. The rise is a transform, so MotionConfig shows the second face at once for reduced motion. The focus ring is on the button, which clips its faces.
  • blur is the second template with it (Balancee 2 px, Kalme 5 px), so an option. It runs on the same bounce-0 spring as the roll; in Framer both are a 200 ms linear tween, and the spring stands in, as it does for arrow="turn". With blur 0 nothing extra is drawn. Filter is not a transform or a size key, so <MotionConfig> does not skip it: the blur is switched off for reduced motion in CSS (motion-reduce:filter-none!, which beats the inline style), so the markup never depends on the preference, and the roll itself is skipped by MotionConfig.
  • dot is Cerette's ring and Kalme's growing dot, the second template with one, so an option and not a component. The box is a fixed 8 px, so the label never moves. It animates width and height as Framer does, so the ring's line stays 1 px while it shrinks (a scale would thin it to 0.5 px); <MotionConfig> skips size keys under reduced motion, so the dot jumps to its hovered size and the fill still fades. It is drawn in the label's colour, so it passes wherever the label does; a brand colour is yours to add with hover: classes.
  • The second copy of the label is aria-hidden, so a screen reader reads the label once.
  • The flip also runs on keyboard focus.
  • The nudging arrow sits in a box 5 px wider than itself, so the nudge stays inside the button, and the padding on that side is 5 px smaller, so the gap at rest is the same on both sides.
  • The turning arrow is Spring Button's, in this button: the label rolls on the bounce-0 spring and the arrow turns on bounce 0.2 (Compose Digi measured 45.6° for 45°, settling in about 0.44 s). It needs no spare room, so the padding is the size's own, and nothing changes colour. It is the third template with this pair (Lookis and Catchup have it too), which is why it is an option and not left to Spring Button plus Flip Button.
  • The sliding arrow is Metuo's: two arrows 5 px apart in a window one arrow wide, so one is always in sight; on hover the pair moves 21 px to the right (Metuo: 19 px for a 14 px arrow), the one in the window leaving at the right as the other comes in from the left, on the same bounce-0 spring as the roll. It is Arrow Flip Link's direction="right" inside a button, and like the turn it needs no spare room. The second arrow is aria-hidden with the rest.
  • The default variant hovers to 95% of its fill, not shadcn's 90%: at 90% the label measures 4.3:1 in a themed project (the Blocks "soft" sample theme, light); at 95% it keeps 4.7:1 or better in all four sample themes, light and dark.

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 (the default variant hovers to bg-primary/95, not shadcn's /90, so its label keeps
  4.5:1 in a coloured theme), 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.
- An arrow prop adds, after the label, a 16px right arrow in a box 21px wide (so there is 5px of room): on hover and focus it
  moves 5px to the right with the same spring while the label rolls. With an arrow the right padding is the size's own
  padding less 5px (pr-[11px] for the default size), so the gap at rest is the same on both sides.
- arrow="turn" instead draws a 16px up-right arrow (path "M4.5 11.5l7-7M5.5 4.5h6v6", stroke 1.5, round caps) 8px after the
  label, which rotates 0 → 45° on hover and focus with its own spring (bounce 0.2, duration 0.4s) while the label rolls on the
  bounce-0 one. No spare room: the padding is the size's own.
- arrow="slide" draws, 8px after the label, a window one arrow wide (size-4, overflow-hidden) holding a row of two right arrows
  (path "M3 8h10M9 4l4 4-4 4", stroke 1.75) 5px apart; the row sits at x -21 at rest, so the right arrow shows, and moves to 0 on hover and
  focus on the same bounce-0 spring as the label, so that one leaves at the right while the other comes in from the left.
- direction ("up" | "right", default "up"): with right the label box holds an invisible copy (it sizes the box and carries the text) and two aria-hidden absolute copies; the first moves x 0% to 100%, the second -100% to 0%, on the same spring, the box overflow-hidden; blur, if set, goes on the copies as it does for the roll.
- iconBox (ReactNode): at the end of the button, ml-3 and size-6 / size-7 / size-8 by size, a grid overflow-hidden rounded-md holding a strip (absolute, flex, w-[200%]) of two covers (w-1/2 each) that goes from x -50% to 0% with the spring, over which the icon (size-4, aria-hidden) changes colour on hover and focus (group/flip on the button). Covers per variant: default primary-foreground, then foreground; secondary and outline foreground, then background; ghost foreground, then primary; the icon is the matching text colour. The button's right padding is pr-1; with no children the box is the whole button (px-1). arrow and dot are not drawn.
- by ("label" | "letter"): with letter and a plain-text label, an invisible copy carries the text and an aria-hidden row of one inline-block motion.span per character sits over it; the button starts with initial false so nothing plays before the first hover; each letter has keyframes rest y [-10, 0] opacity [0, 1] and hover y [10, 0] opacity [0, 1], on a spring (bounce 0.2, duration 0.2s) delayed index * 0.075s, with motion-reduce:transform-none!.
- face ("default" | "secondary" | "outline" | "ghost"): the button becomes overflow-hidden with only its height class and holds a motion.span column (flex-col, w-full) of two faces, each a flex span with the size's height and padding and that variant's fill and line without hover classes (default: bg-primary text-primary-foreground; secondary: bg-secondary text-secondary-foreground; outline: border bg-background shadow-xs dark:border-input dark:bg-input/30; ghost: transparent): the first is variant, the second face, aria-hidden. The column goes from y 0% to -50% with the same spring on hover and focus. arrow, dot and blur are not drawn.
- blur (px, default 0): when above 0 the two copies of the label are motion.spans that animate filter with the roll's spring: the first from blur(0px) to blur(npx), the second from blur(npx) to blur(0px), both with motion-reduce:filter-none!. With 0 they are plain spans.
- dot="ring" or "grow" draws instead, 8px after the label, a size-2 aria-hidden box that never changes size, with a rounded-full dot in currentColor inside it, on the bounce-0 spring: ring is a 1px border whose width and height go 8 to 4px while a bg-current layer fades 0 to 1; grow is a bg-current dot going 6 to 8px and from opacity 0.6 to 1. Animate width and height, not scale.

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