TextSwap
Spring-powered text morphing and ticker. Auto-cycles phrases or animates whenever children change with blur and slide transitions.
import { TextSwap } from "@/components/ui/text-swap";export function DynamicTag() { return ( <span className="font-medium"> Crafted with{" "} <TextSwap items={["Next.js 16", "Tailwind CSS 4", "motion 14"]} direction="up" /> </span> );}<TextSwap>
childrenstringA single string; changing it swaps to the new text.
directiondefault"up""up" | "down" | "fade"Swap direction (default: "up").
indexnumberActive index when controlling externally.
intervaldefault3000numberMilliseconds between swaps when cycling automatically (default: 3000).
itemsreadonly string[]Array of items to cycle through, or pass a single changing child.
pauseOnHoverdefaulttruebooleanPause the cycle on mouse hover (default: true).
| Prop | Type | Default |
|---|---|---|
childrenA single string; changing it swaps to the new text. | string | — |
directionSwap direction (default: "up"). | "up" | "down" | "fade" | "up" |
indexActive index when controlling externally. | number | — |
intervalMilliseconds between swaps when cycling automatically (default: 3000). | number | 3000 |
itemsArray of items to cycle through, or pass a single changing child. | readonly string[] | — |
pauseOnHoverPause the cycle on mouse hover (default: true). | boolean | true |
* required. Every component also takes className.