← All components
Text / effect

Rotating Text

Spring-driven word transitions with expressive glyph staggering and smooth width changes.

PLAYGROUND
Live preview
Preparing preview…

Take it with you.

SOURCE ACCESS

Preview freely. Unlock the files.

Enter the shared password to copy the complete source, download every file, and install components in your app.

Access lasts 24 hours. Your preview settings stay with you.

Component notes

  • Import RotatingText.tsx for the reusable effect, or Demo.tsx for the full Make it composition. texts accepts a string array or pipe-separated string; arrays preserve literal pipe characters.
  • The source spring, wait-mode exit/enter sequence, staggered glyphs, vertical offsets and width transition are retained. Spring settings and offsets replace arbitrary Motion variants so all motion shares one owned clock.
  • Pause freezes the current pose and remaining interval. Hidden and offscreen time is excluded. Reduced motion shows static text; imperative navigation stays available.
  • An unsplit accessible label accompanies aria-hidden animated glyphs. No automatic live-region announcements interrupt reading. Emoji graphemes remain whole where Intl.Segmenter is available.
  • Work is bounded to 40 strings and 500 graphemes per string. Interval is clamped to 250–60000ms; stagger to 0–0.2 seconds. Custom splitBy strings act as delimiters. Text-list changes reset to the first item.
React 19.2Intl.Segmenter

React Bits · MIT with Commons Clause. Used with explicit project permission; see bundled notice.

Props

PropTypeDefaultDescription
textsstring[] | string"beautiful|expressive|yours"Words (separate with |)
rotationIntervalnumber2000Interval
staggerDurationnumber0Stagger
staggerFromstring | number"first"Stagger origin
splitBystring"characters"Split by
stiffnessnumber300Spring stiffness
dampingnumber25Spring damping
massnumber1Spring mass
enterOffsetnumber100Enter offset
exitOffsetnumber-120Exit offset
autobooleantrueAutomatic rotation
loopbooleantrueLoop
onNext(index: number) => voidundefinedCalled when the logical text index changes.
refRotatingTextRefundefinedImperative next(), previous(), jumpTo(index) and reset().
transition{ stiffness?: number; damping?: number; mass?: number }undefinedOptional spring settings override the corresponding scalar props.
mainClassNamestring''Class hook for the outer text, word groups or individual glyphs.
splitLevelClassNamestring''Class hook for the outer text, word groups or individual glyphs.
elementLevelClassNamestring''Class hook for the outer text, word groups or individual glyphs.
pausedbooleanfalseFreeze decorative motion.
replayTokennumber0Change to reset.
classNamestring''Additional outer classes.