Dynamic Text - React Component | Kokonut UI
Dynamic Text
Morphing text where shared letters travel, old ones fall and new ones land, with decode and cycle modes.
Install with
npx shadcn@latest add https://kokonutui.com/r/dynamic-text.json
Installation
Dynamic Text is a free, open-source React component in the Kokonut UI Texts collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/dynamic-text.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/dynamic-text
Usage
import DynamicText from "@/components/kokonutui/dynamic-text";
export default function Example() {
return <DynamicText />;
}
Props
mode
DynamicTextModeDefault: "morph"morph: letters travel, fall and land.decode: monospace cells scramble and lock left to right.cycle: morphs throughwordswith a greeting rhythm (a long first word, faster middle words, a hold on the last).
text
string
The string to show. Change it to animate. When set,wordsis ignored.
words
(string | Greeting)[]
Words to rotate through whentextis not set.
interval
number
Milliseconds each word holds. Incyclemode this is the first word's hold; the middle words speed up from there.
loop
boolean
Start over after the last word. Defaults to true, except incycle.
onComplete
() => void
Called once the last word is shown. Never called when looping.
className
string
Extra classes for the root element.
DynamicTextMode
type DynamicTextMode = "morph" | "decode" | "cycle";
Greeting
textrequiredstringlang
BCP 47 language tag, so screen readers pronounce each word correctly.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.