TextNew

Text Rotate

A word in the headline swaps for others with a letter-by-letter spring. Made for hero sections.

Customize

gradientFrom
gradientTo
backgroundColor

Based on Text Rotate (MIT license) · Terms of use

More in Pro

View all

Props

17 properties
PropertyTypeDefaultDescription
textsstring[]—Words or phrases that replace each other.
rotationIntervalnumber2000How long each word stays, in milliseconds.
staggerDurationnumber0Delay between letters, in seconds.
staggerFrom'first' | 'last' | 'center' | 'random' | number"first"Which letter the wave starts from.
splitBy'characters' | 'words' | 'lines' | string"characters"How the text is split: by characters, words or lines.
loopbooleantrueStart over after the last word.
autobooleantrueChange words automatically.
animatePresenceMode'wait' | 'popLayout' | 'sync'"wait"Whether the old word leaves before the new one enters.
initial / animate / exitMotionProps—Enter and exit animation states in Motion format.
transitionTransition"{ type: 'spring', damping: 25, stiffness: 300 }"Spring or timing settings.
mainClassNamestring—Classes for the outer box, e.g. a pill background.
splitLevelClassNamestring—Classes for each word wrapper.
elementLevelClassNamestring—Classes for each letter.
onNext(index: number) => void—Called when the word changes.
gradientFromstring"#ffffff"Colour of the first letter. The text fades into the gradient end colour.
gradientTostring"#d4d4d8"Colour of the last letter, the end of the gradient.
backgroundColorstring"rgba(255,255,255,0.1)"Fill of the pill behind the changing word.

Dependencies

3 required packages

npm install motion clsx tailwind-merge

Related components

View all