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
- Segmentation: You provide a text string as the
children
prop. Theby
prop (values:"text"
,"line"
,"word"
,"character"
) tellsKineticText
how to break this string down into smaller, animatable segments. - 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 (likeonScroll
,loop
,startOnView
, customduration
) available inKinetic
can be applied to each text segment. - 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. - Layout: For
"character"
and"word"
segmentations,KineticText
appliesdisplay: flex
andflex-wrap: wrap
to its main container div. This ensures that the animated segments (which arediv
s rendered byKinetic
) flow correctly like text, wrapping lines as needed. - 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 newoffset
prop for precise scroll completion),startOnView
,once
,viewportOptions
, andtransition
. 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
Prop | Type | Default |
---|---|---|
children* | string | — |
by | enum | — |
stagger | number | 0.05 |
scrollStagger | number | 0.2 |
scrollSegmentOverlap | number | 0.7 |
delay | number | — |
className | string | — |
style | React.CSSProperties | — |
onScroll | KineticProps["onScroll"] | false |
offset | KineticProps["offset"] | — |