Skip to content

A Mantine UI Library Extension Text Animation component

License

Notifications You must be signed in to change notification settings

gfazioli/mantine-text-animate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mantine Text Animate Component

Mantine Text Animate

Overview

This component is created on top of the Mantine library.

Mantine TextAnimate is a comprehensive animation toolkit for text in React, designed to integrate seamlessly with Mantine UI. At its core, the TextAnimate component lets you choose entry/exit/static states and apply animations such as slide, scale, and blur, while controlling granularity with the by prop (character, word, line) and timing through duration, delay, and segmentDelay. Fine‑tuning is enabled via animateProps—translateDistance, scaleAmount, and blurAmount—so you can tailor motion intensity per effect. Event handlers like onAnimationStart and onAnimationEnd make it straightforward to react to animation lifecycles.

Beyond basic text transitions, the package offers higher‑level primitives for common patterns: TextAnimate.Typewriter and the useTypewriter hook provide cursor and blink options, speed/delay controls, loop behavior, multiline rendering, and hooks to start/stop/reset typing, plus onTypeEnd and onTypeLoop callbacks.

For data presentations, useNumberTicker animates numeric values with speed, easing, and completion callbacks, while useTextTicker reveals target strings from random characters with configurable character sets, reveal direction, and lifecycle control. Styling is fully compatible with Mantine props, and global styles can be imported directly or within a CSS layer, making the system flexible for documentation sites, dashboards, and rich UI interactions.

Installation

npm install @gfazioli/mantine-text-animate

or

yarn add @gfazioli/mantine-text-animate

After installation import package styles at the root of your application:

import '@gfazioli/mantine-text-animate/styles.css';

Usage

import { TextAnimate } from '@gfazioli/mantine-text-animate';

function Demo() {
  return (
<TextAnimate animate="in" animation="slideUp" by="character">
      Mantine TextAnimate component
    </TextAnimate>
  );
}

TextAnimate.Typewriter

ta-02.mp4
import { TextAnimate } from '@gfazioli/mantine-text-animate';

function Demo() {
  return (
    <TextAnimate.Typewriter value="Hello, World! Mantine Typewriter component" animate />
  );
}

useTypewriter

import { useTypewriter } from '@gfazioli/mantine-text-animate'

function Demo() {
    const { text, start, stop, reset, isTyping } = useTypewriter({
    value: ['Hello', 'From', 'Mantine useTypewriter() hook'],
  });

  return (
    <div>{text}</div>
  );
}

TextAnimate.Spinner

ta-03.mp4
import { TextAnimate } from '@gfazioli/mantine-text-animate';

function Demo() {
  return (
    <TextAnimate.Spinner>★ SPINNING TEXT EXAMPLE ★</TextAnimate.Spinner>
  );
}

TextAnimate.NumberTicker

ta-04.mp4
import { TextAnimate } from '@gfazioli/mantine-text-animate';

function Demo() {
  return (
    <TextAnimate.NumberTicker value={100} animate />
  );
}

useNumberTicker

import { useNumberTicker } from '@gfazioli/mantine-text-animate'

function Demo() {
  const { text, isAnimating, start, stop, reset, displayValue } = useNumberTicker({
    value: 64,
    startValue: 0,
    delay: 0,
    decimalPlaces: 0,
    speed: 0.2,
    easing: 'ease-out',
    animate: true,
  });

  return (
    <div>{text}</div>
  );
}

TextAnimate.TextTicker

ta-05.mp4
import { TextAnimate } from '@gfazioli/mantine-text-animate';

function Demo() {
  return (
    <TextAnimate.TextTicker value="Hello, World! Mantine TextTicker component" animate />
  );
}

useTextTicker

import { useTextTicker } from '@gfazioli/mantine-text-animate'

function Demo() {
  const { text, isAnimating, start, stop, reset } = useTextTicker({
    value: 'Mantine useTextTicker',
    delay: 0,
    speed: 0.2,
    easing: 'ease-out',
    animate: true,
  });

  return (
    <div>{text}</div>
  );
}

Sponsor

Your support helps me:

  • Keep the project actively maintained with timely bug fixes and security updates
  • Add new features, improve performance, and refine the developer experience
  • Expand test coverage and documentation for smoother adoption
  • Ensure long‑term sustainability without relying on ad hoc free time
  • Prioritize community requests and roadmap items that matter most

Open source thrives when those who benefit can give back—even a small monthly contribution makes a real difference. Sponsorships help cover maintenance time, infrastructure, and the countless invisible tasks that keep a project healthy.

Your help truly matters.

💚 Become a sponsor today and help me keep this project reliable, up‑to‑date, and growing for everyone.


ta-01.mp4

Star History Chart