Rotating Textv1.1.0--:--
Now flippingReact 18, no other dependencies, MIT

Rotating Text

A 3D flip-on-hover text component for React, with no dependencies beyond React. Hover the name.

Every tiled word on this page is the component, running.Tap the name to see it flip.

$ npm install rotating-text
Examples

Departures

Each row is a preset. Hover or tap a word to run it, or press Try it to load its settings into the playground.

WordStaggerTimingFeelStatusLoad into playground
HOVERME0.100.50The defaultsOn time
SNAP0.030.25Quick, for buttonsEarly
CASCADE0.140.60A visible waveOn time
DRIFT0.221.20Slow, for headingsDelayed
RIPPLE0.060.2 → 0.8 → 0.4Per-letter timing arrayOn time
Interactive

Playground

HOVERME

Hover or tap the word. The tiles are this page's own CSS; the component ships plain letters you style with className.

One word or a short phrase. Spaces collapse and nothing wraps.

Seconds between each letter starting. Default 0.1.

Seconds per letter: one number, or one per letter separated by commas. Default 0.5.

Not a prop: set it with style or className.

Your snippet
MyApp.tsx
import { RotatingText } from 'rotating-text'
import 'rotating-text/dist/index.css'

function MyApp() {
  return (
    <RotatingText
      text="HOVERME"
      stagger={0.1}
      timing={0.5}
      style={{ fontSize: '96px' }}
    />
  )
}
Getting started

Install and use

  1. Install the package

    Terminal
    npm install rotating-text
  2. Import the component and its CSS

    MyApp.tsx
    import React from 'react'
    
    import { RotatingText } from 'rotating-text'
    import 'rotating-text/dist/index.css'
    
    function MyApp() {
      return (
        <RotatingText
          text="HOVERME"
          stagger={0.1}
          timing={0.5}
          className="rotating-text"
          style={{ fontSize: '100px' }}
        />
      )
    }

Peer dependency: React 18. Nothing else is installed.

Reference

Props

PropTypeDefaultDescription
textstring(required)Text to animate.
staggernumber0.1Seconds between each letter starting its animation.
timingnumber | number[]0.5Seconds each letter's animation lasts, or one duration per letter.
variant'roll' | 'flap''roll'roll turns each letter over like a cube; flap draws split-flap tiles.
classNamestringundefinedClass name added to the outer container.
styleReact.CSSPropertiesundefinedInline styles applied to the outer container.
Before you ship

Notes

  • Works best with one word or a short phrase. Text does not wrap, and spaces collapse, so use one component per word.
  • The flip starts on hover. On touch screens, a tap starts it. A flip always runs to the end.
  • With reduced motion turned on, the flip becomes a gentle scale.