Text Animate
Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/text-animate.json
Use case
Animate text by character, word, line or complete text.
Native props used by the examples
Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.
| Owning component prop | Explanation | Example source |
|---|---|---|
TextAnimate.animation (text-animate) | Native TextAnimate preset name. | examples/text-animate-demo.tsx、examples/text-animate-demo-2.tsx、examples/text-animate-demo-3.tsx、examples/text-animate-demo-4.tsx、examples/text-animate-demo-5.tsx、examples/text-animate-demo-6.tsx、examples/text-animate-demo-7.tsx、examples/text-animate-demo-8.tsx |
TextAnimate.by (text-animate) | TextAnimate segmentation: text, word, character or line. | examples/text-animate-demo.tsx、examples/text-animate-demo-3.tsx、examples/text-animate-demo-4.tsx、examples/text-animate-demo-5.tsx、examples/text-animate-demo-6.tsx、examples/text-animate-demo-7.tsx、examples/text-animate-demo-8.tsx、examples/text-animate-demo-9.tsx |
TextAnimate.once (text-animate) | Play the viewport-triggered text animation once. | examples/text-animate-demo.tsx |
TextAnimate.children (text-animate) | Native child content; keep the owning component's text/element constraints. | examples/text-animate-demo.tsx、examples/text-animate-demo-2.tsx、examples/text-animate-demo-3.tsx、examples/text-animate-demo-4.tsx、examples/text-animate-demo-5.tsx、examples/text-animate-demo-6.tsx、examples/text-animate-demo-7.tsx、examples/text-animate-demo-8.tsx、examples/text-animate-demo-9.tsx |
TextAnimate.as (text-animate) | Native rendered element type; retain valid semantic HTML. | examples/text-animate-demo-2.tsx、examples/text-animate-demo-5.tsx |
TextAnimate.delay (text-animate) | Native start delay; Motion seconds versus typing/terminal milliseconds must not be mixed. | examples/text-animate-demo-7.tsx |
TextAnimate.duration (text-animate) | Native animation duration; numeric/CSS units differ by owner, see source defaults. | examples/text-animate-demo-8.tsx |
TextAnimate.variants (text-animate) | Native Motion variants, not catalog example names. | examples/text-animate-demo-9.tsx |
Interaction and state checks
- Text Animate Demo —
text-animate-demo - Text Animate Demo 2 —
text-animate-demo-2 - Text Animate Demo 3 —
text-animate-demo-3 - Text Animate Demo 4 —
text-animate-demo-4 - Text Animate Demo 5 —
text-animate-demo-5 - Text Animate Demo 6 —
text-animate-demo-6 - Text Animate Demo 7 —
text-animate-demo-7 - Text Animate Demo 8 —
text-animate-demo-8 - Text Animate Demo 9 —
text-animate-demo-9
These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.
Business integration boundary
children is text; by and animation select native segmentation/presets. Keep the accessibility behavior rather than duplicating spoken segments.
Host and motion setup
Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.
Available examples
text-animate-demo, text-animate-demo-2, text-animate-demo-3, text-animate-demo-4, text-animate-demo-5, text-animate-demo-6, text-animate-demo-7, text-animate-demo-8, text-animate-demo-9
Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.
Installation
<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">npx shadcn@latest add @magicui/text-animate
</TabsContent>
<TabsContent value="manual">
<Steps>
<Step>Copy and paste the following code into your project.</Step>
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </Tabs>Examples
Blur In by Text
Slide Up by Word
Scale Up by Text
Fade In by Line
Slide Left by Character
With Delay
With Duration
With Custom Motion Variants
Usage
import { TextAnimate } from "@/components/ui/text-animate"
<TextAnimate animation="blurInUp" by="word">
Blur in by word
</TextAnimate>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | - | The text content to animate |
className | string | - | The class name to be applied to the component |
segmentClassName | string | - | The class name to be applied to each segment |
delay | number | 0 | Delay before animation starts |
duration | number | 0.3 | Duration of the animation |
variants | Variants | - | Custom motion variants for the animation |
as | "article" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "p" | "section" | "span" | "p" | The element type to render |
by | "text" | "word" | "character" | "line" | "word" | How to split the text ("text", "word", "character") |
startOnView | boolean | true | Whether to start animation when component enters viewport |
once | boolean | false | Whether to animate only once |
animation | AnimationVariant | "fadeIn" | The animation preset to use |
accessible | boolean | true | Whether to render an accessible screen-reader label |
Complete example installation
The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.
Text Animate Demo
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo.json
Default import: @/components/magicui/examples/text-animate-demo
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 2
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-2.json
Default import: @/components/magicui/examples/text-animate-demo-2
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 3
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-3.json
Default import: @/components/magicui/examples/text-animate-demo-3
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 4
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-4.json
Default import: @/components/magicui/examples/text-animate-demo-4
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 5
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-5.json
Default import: @/components/magicui/examples/text-animate-demo-5
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 6
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-6.json
Default import: @/components/magicui/examples/text-animate-demo-6
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 7
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-7.json
Default import: @/components/magicui/examples/text-animate-demo-7
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 8
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-8.json
Default import: @/components/magicui/examples/text-animate-demo-8
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Text Animate Demo 9
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/text-animate/text-animate-demo-9.json
Default import: @/components/magicui/examples/text-animate-demo-9
Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0
Minimal usage and theme
import Demo from '@/components/magicui/examples/text-animate-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}
Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.
Source-backed parameter reference
Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.
TextAnimate({
children,
delay = 0,
duration = 0.3,
variants,
className,
segmentClassName,
as: Component = "p",
startOnView = true,
once = false,
by = "word",
animation = "fadeIn",
accessible = true,
...props
}: TextAnimateProps)
type AnimationType = "text" | "word" | "character" | "line"
type AnimationVariant =
| "fadeIn"
| "blurIn"
| "blurInUp"
| "blurInDown"
| "slideUp"
| "slideDown"
| "slideLeft"
| "slideRight"
| "scaleUp"
| "scaleDown"
type MotionElementType = Extract<
keyof DOMMotionComponents,
keyof typeof motionElements
>
interface TextAnimateProps extends Omit<MotionProps, "children"> {
/**
* The text content to animate
*/
children: string
/**
* The class name to be applied to the component
*/
className?: string
/**
* The class name to be applied to each segment
*/
segmentClassName?: string
/**
* The delay before the animation starts
*/
delay?: number
/**
* The duration of the animation
*/
duration?: number
/**
* Custom motion variants for the animation
*/
variants?: Variants
/**
* The element type to render
*/
as?: MotionElementType
/**
* How to split the text ("text", "word", "character")
*/
by?: AnimationType
/**
* Whether to start animation when component enters viewport
*/
startOnView?: boolean
/**
* Whether to animate only once
*/
once?: boolean
/**
* The animation preset to use
*/
animation?: AnimationVariant
/**
* Whether to enable accessibility features (default: true)
*/
accessible?: boolean
}
Destructuring defaults in source
Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.
// TextAnimate
delay = 0
// TextAnimate
duration = 0.3
// TextAnimate
as = "p"
// TextAnimate
startOnView = true
// TextAnimate
once = false
// TextAnimate
by = "word"
// TextAnimate
animation = "fadeIn"
// TextAnimate
accessible = true
Native and external types
External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.
Omit<MotionProps, "children">
MotionProps
Variants
Extract<
keyof DOMMotionComponents,
keyof typeof motionElements
>
DOMMotionComponents