Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-flip-toolkit

> 前端框架
Open source

A lightweight magic-move library for configurable layout transitions

4.2K stars0 likes1 views
WebsiteGitHub

About

A lightweight magic-move library for configurable layout transitions

**Comparison with other React FLIP libraries**
Feature react-flip-move react-overdrive react-flip-toolkit
Animate position ✅ ✅ ✅
Animate scale ❌ ✅ ✅
Animate opacity ❌ ✅ ✅
Animate parent's size without warping children ❌ ❌ ✅
Use real FLIP instead of cloning & crossfading ✅ ❌ ✅
Use springs for animations ❌ ❌ ✅
Support spring-based stagger effects ❌ ❌ ✅
Usable with frameworks other than React ❌ ❌ ✅

Quick start

npm install react-flip-toolkit or yarn add react-flip-toolkit

  1. Wrap all animated children with a single Flipper component that has a flipKey prop that changes every time animations should happen.

  2. Wrap elements that should be animated with Flipped components that have a flipId prop matching them across renders.

Table of Contents

  • Forkable Examples
    • Simple Example: An Expanding Div
    • Simple Example: Two Divs
    • Simple Example: List Shuffle
    • List Transitions
    • Stagger Effects
    • Spring Customizations
    • Nested Scale Transforms
    • Route-based Animations With React Router
    • More examples
  • The Components
    • Flipper
      • Basic Props
      • Advanced Props
    • Flipped
      • Wrapping a React Component
      • Basic props
      • Callback props
      • Transform props
      • Advanced props
    • Spring
  • Library details
  • Troubleshooting
    • Problem #1: Nothing is happening
    • Problem #2: Things look weird / animations aren't behaving
    • Problem #3: It's still not working
  • Performance
    • Memoization
    • will-change:transform

Forkable Examples

Simple Example: An Expanding Div

Fork this example on Code Sandbox

javascript
import React, { useState } from 'react'
import { Flipper, Flipped } from 'react-flip-toolkit'

const AnimatedSquare = () => {
  const [fullScreen, setFullScreen] = useState(false)
  const toggleFullScreen = () => setFullScreen(prevState => !prevState)

  return (
    <Flipper flipKey={fullScreen}>
      <Flipped flipId="square">
        

    </Flipped>
  </div>
</Flipped>

By default, both the scale and the translation transforms of the parent will be counteracted (this allows children components to make their own FLIP animations without being affected by the parent). But for many use cases, you'll want to additionally specify the scale prop to limit the adjustment to the scale and allow the positioning to move with the parent.

Note: the DOM element with the inverse transform should lie flush against its parent container for the most seamless animation.

That means any layout styles — padding, flexbox, etc—should be applied to the inverted container (the element wrapped with a Flipped component with an inverseFlipId) rather than the parent Flipped container.

Route-based Animations With React Router

Fork Github repo

react-flip-toolkit works great with client-side routers to provide route-driven transitions:

javascript
<Route
  render={({ location, search }) => {
    return (
      <Flipper
        flipKey={`${location.pathname}-${location.search}`}
      >
      {/* Child routes that contain Flipped components go here...*/}
      </Flipper>
    )
  }}
/>

More examples

  • Guitar shop
  • React-flip-toolkit logo
  • Using Portals

The Components

Flipper

The parent wrapper component that contains all the elements to be animated. You'll often need only one of these per page, but sometimes it will be more convenient to have multiple Flipper regions of your page concerned with different transitions.

javascript
<Flipper flipKey={someKeyThatChanges}>{/* children */}</Flipper>

Basic Props

prop default type details
flipKey (required) - string, number, bool Changing this tells react-flip-toolkit to transition child elements wrapped in Flipped components.
children (required) - node One or more element children
spring noWobble string or object Provide a string referencing one of the spring presets — noWobble (default), veryGentle, gentle, wobbly, or stiff, OR provide an object with stiffness and damping parameters. Explore the spring setting options here. The prop provided here will be the spring default that can be overrided on a per-element basis on the Flipped component.
applyTransformOrigin true bool Whether or not react-flip-toolkit should apply a transform-origin of "0 0" to animating children (this is generally, but not always, desirable for FLIP animations)
element div string If you'd like the wrapper element created by the Flipped container to be something other than a div, you can specify that here.
className - string A class applied to the wrapper element, helpful for styling.
staggerConfig - object Provide configuration for staggered Flipped children. The config object might look something like the code snippet below:
javascript
staggerConfig={{
  // the "default" config will apply to staggered elements without explicit keys
      default: {
        // default direction is forwards
        reverse: true,
        // default is .1, 0 < n < 1
        speed: .5
      },
  // this will apply to Flipped elements with the prop stagger='namedStagger'
    namedStagger : { speed: .2 }
  }}

Advanced Props

| prop | default | type | details

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptanimation-libraryflip-animationslayout-animationreactjs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架