@gfazioli/mantine-text-animate
A Mantine component that allows you to animate text with various effects. Additionally, it provides other sub components such as TextAnimate.TextTicker, TextAnimate.Typewriter, TextAnimate.NumberTicker, and TextAnimate.Spinner. You can also use three useful hooks: useTextTicker, useTypewriter, and useNumberTicker.
Update from v2 to v3
v3.0.0 introduces new features and breaking changes:
Breaking Changes
- Spinner
childrentype: Now acceptsstring | React.ReactNode[]. When passing aReactNode[], text processing (repeat/reverse) is skipped and you must provide an explicitaria-label. speedprop semantics: Thespeedprop on Typewriter, Gradient, and Highlight now works as a multiplier — higher values mean faster animation (consistent with all other components). Previous behavior was inverted (higher = slower). Default values changed: Typewriter0.03→1, Gradient3→1. If you were using customspeedvalues, invert them (e.g., oldspeed={0.01}on Typewriter ≈ newspeed={3}).
New Features (v3.0)
onCharTypecallback on Typewriter — called for each character typed with(char, index)pauseAtprop on Typewriter — map of char index → pause duration (ms) for custom pausesprefix/suffixprops on NumberTicker — render content before/after the numberonAnimationCompletecallback on TextAnimate — fires when all segments finish animatingtriggerprop on TextAnimate —'mount'(default),'inView'(IntersectionObserver), or'manual'useTextAnimate()hook — returns{ animate, setAnimate, replay, isAnimating, key, onAnimationComplete }TextAnimate.Gradientcompound component — animated gradient text viabackground-clip: textanimate="loop"on TextAnimate — automatic in→pause→out→pause cycle with configurableloopDelaywithSoundprop on Typewriter — synthesized mechanical keyboard click via Web Audio APIformatValueprop on NumberTicker — override the defaultIntl.NumberFormatformatting- Scramble mode on TextTicker — deterministic per-character scramble via
scrambleDurationandstaggerDelay TextAnimate.Highlightcompound component — animated highlighter marker effect (CSS-only)TextAnimate.SplitFlapcompound component — airport departure board (Solari board) 3D flip displayTextAnimate.Morphingcompound component — fluid text transitions using LCS algorithmTextAnimate.RotatingTextcompound component — animated text carousel with slide/fade/blur transitions
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-text-animate by importing @gfazioli/mantine-text-animate/styles.layer.css file.
TextAnimate
The TextAnimate component allows you to animate text with various effects. The animate prop controls the initial display and the direction of the animation.
In the example below, try selecting none to display nothing. With static, the text will appear static.
Selecting Animate In will display the entering animation, and with Animate Out, the exiting animation will be shown.
animateProps
The animateProps prop allows you to pass additional props to the animation.
by
The by prop allows you to animate text by the entire text, character by character, per word or line by line.
By using the by="line" prop, you can animate text line by line.
Styling
Of course, you can use the component with your own styles.
onAnimationStart and onAnimationEnd
You can use the onAnimationStart and onAnimationEnd props to handle animation events.
trigger
The trigger prop controls when the animation starts. Use "inView" to animate when the element enters the viewport via IntersectionObserver.
You can pass triggerOptions to customize threshold and rootMargin.
Scroll down to see the animation trigger...
Loop mode
Set animate="loop" to automatically cycle through in→pause→out→pause→in. Use loopDelay to control the pause duration between phases (default: 2000ms).
useTextAnimate() hook
The useTextAnimate hook provides state and controls for managing TextAnimate animation direction, replay capability, and animation status tracking.
The return value of the useTextAnimate hook is the following:
TextAnimate.Typewriter
The TextAnimate.Typewriter component allows you to animate text with a typewriter effect.
Multiline
By using the multiline prop, you can animate text line by line.
leftSection
You may use the leftSection prop to display a section before the text.
>
Styling
Of course, you can use the component with your own styles.
onTypeEnd and onTypeLoop
You can use the onTypeEnd and onTypeLoop props to handle typewriter events.
withSound
Enable withSound to play a synthesized mechanical keyboard click on each character typed. The sound is generated via Web Audio API (no external files). Use soundVolume to control volume (0–1). The AudioContext is lazily initialized on the first sound, so a user gesture is required. Respects prefers-reduced-motion.
onCharType and pauseAt
The onCharType callback is called for each character typed, receiving the character and its index. Combined with pauseAt, you can create dramatic pauses at specific character positions — for example, pausing after punctuation for a more natural typing rhythm.
Pauses 800ms after "Hello," and 1200ms after "World!"
useTypewriter() hook
The TextAnimate.Typewriter is built by using the useTypewriter hook.
Done
The interface of the useTypewriter hook is the following:
And the return value of the useTypewriter hook is the following:
Multiline with useTypewriter()
You may use the multiline prop with the useTypewriter hook.
In this case the text will be an array of strings.
Example: Terminal
Below a fun example of a terminal.
TextAnimate.Spinner
The TextAnimate.Spinner component allows you to animate text with a spinner effect.
The children prop accepts either a string (for text processing) or an array of React.ReactNode (for custom content like icons).
repeatText and repeatCount
TextAnimate.NumberTicker
The TextAnimate.NumberTicker component allows you to animate text with a number ticker effect.
You can use the prefix and suffix props to display content before and after the number.
0
formatValue
Use the formatValue prop to override the default Intl.NumberFormat formatting. This is useful for custom currency, percentage, or unit formatting.
$0.00
useNumberTicker() hook
The TextAnimate.NumberTicker is built by using the useNumberTicker hook.
Done
0
The interface of the useNumberTicker hook is the following:
And the return value of the useNumberTicker hook is the following:
Example

Norway Fjord Adventures
100.99
$With Mountain Expeditions, you can immerse yourself in the breathtaking mountain scenery through tours and activities in and around the majestic peaks
Download0

Norway Fjord Adventures
200.00
$With Fjord Tours you can explore more of the magical fjord landscapes with tours and activities on and around the fjords of Norway
Download0
TextAnimate.TextTicker
The TextAnimate.TextTicker component allows you to animate text with a text ticker effect.
Scramble mode
When scrambleDuration is set, TextTicker switches to a deterministic "scramble" mode where each character cycles through random characters for a fixed duration before settling on the target. Use staggerDelay to control the delay between each character starting its animation.
useTextTicker() hook
The TextAnimate.TextTicker is built by using the useTextTicker hook.
Done
The interface of the useTextTicker hook is the following:
And the return value of the useTextTicker hook is the following:
Example
Welcome
TextAnimate.Gradient
The TextAnimate.Gradient component displays text with an animated gradient background. It accepts an array of Mantine colors and animates the gradient via background-clip: text.
TextAnimate.Highlight
The TextAnimate.Highlight component creates an animated highlighter marker effect on text. It uses a CSS animation to sweep a colored background from left to right, simulating a text highlighter pen.
TextAnimate.RotatingText
The TextAnimate.RotatingText component cycles through an array of text strings with smooth enter/exit animations. It supports multiple transition variants (slide, fade, blur) and is designed to be used inline alongside static text.
useRotatingText() hook
The TextAnimate.RotatingText is built by using the useRotatingText hook.
Hello
Index: 0 | Transitioning: no
The interface of the useRotatingText hook is the following:
And the return value of the useRotatingText hook is the following:
TextAnimate.SplitFlap
The TextAnimate.SplitFlap component recreates the classic airport/train station split-flap display (Solari board). Each character flips through the character set in order until reaching its target, with a 3D CSS flip animation.
useSplitFlap() hook
The TextAnimate.SplitFlap is built by using the useSplitFlap hook.
Done
Styles API
Component Styles API
Hover over selectors to highlight corresponding elements
TextAnimate.Morphing
The TextAnimate.Morphing component creates fluid text transitions between two strings. It uses the Longest Common Subsequence (LCS) algorithm to identify shared characters — common characters smoothly move to their new positions, while removed characters fade out and new characters fade in. Requires a monospace font for accurate positioning (uses ch units).
useMorphing() hook
The TextAnimate.Morphing is built by using the useMorphing hook.
Done