Kinetic Text

The KineticText component, built upon the versatile Kinetic component, offers a powerful way to create engaging and dynamic text animations.

Playground

Customize the Kinetic Text properties to see different variations.

Text to animate

Customize

Installation

pnpm dlx shadcn@latest add https://shadcn-ui-variants.vercel.app/r/kinetic-text.json

Overview

KineticText is designed to bring text to life by applying a wide range of animations to individual segments of a string—be it entire blocks of text, separate lines, words, or even single characters. This allows for sophisticated typographic effects that can enhance user engagement, guide attention, or simply add a polished, dynamic feel to your application.

Functioning

Examples

  1. Segmentation: You provide a text string as thechildren prop. The by prop (values: "text", "line", "word","character") tells KineticText how to break this string down into smaller, animatable segments.
  2. Individual Animation: Each of these segments is then wrapped in an instance of the Kinetic component. This means every animation type (fadeIn, blurInUp, bounce, elastic, etc.) and feature (like onScroll, loop, startOnView, custom duration) available in Kinetic can be applied to each text segment.
  3. Staggering: The stagger prop introduces a small delay between the start of each segment's animation. This creates a beautiful cascading or sequential reveal effect, making the text appear as if it's typing out, fading in word by word, or animating character by character.
  4. Layout: For "character" and "word" segmentations,KineticText applies display: flex and flex-wrap: wrap to its main container div. This ensures that the animated segments (which aredivs rendered by Kinetic) flow correctly like text, wrapping lines as needed.
  5. Comprehensive Control: You retain full control over the animation through props like animation, duration, delay(which acts as a base delay for the entire sequence), loop,onScroll (with the new offset prop for precise scroll completion),startOnView, once, viewportOptions, and transition. These are passed down and applied to each segment's animation.

Character-by-Character 'Fade In Up' on View

W
e
l
c
o
m
e
 
t
o
 
O
u
r
 
W
o
r
l
d

Word-by-Word 'Blur In' on Scroll

Discover
the
amazing
features
as
you
scroll
through
our
innovative
platform.
Each
word
reveals
itself,
guiding
you
on
a
journey
of
exploration.

Line-by-Line 'Bouncing' Animation with Loop

Creativity is intelligence having fun.
Albert Einstein

Full Text 'RotateIn' with Custom Transition

KINETIC!

KineticText Props

PropTypeDefault
children*
string
by
enum
stagger
number0.05
scrollStagger
number0.2
scrollSegmentOverlap
number0.7
delay
number
className
string
style
React.CSSProperties
onScroll
KineticProps["onScroll"]false
offset
KineticProps["offset"]