text-morphing
jolyui-ui/text-morphingFreeComponent
jolyui/ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by jolyui/ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://jolyui.dev/r/text-morphing.jsonSource
1import { AnimatePresence, motion } from "motion/react";2import * as React from "react";3import { cn } from "@/lib/utils";45interface MorphingTextProps {6 words: string[];7 className?: string;8 interval?: number;9 animationDuration?: number;10}1112const MorphingText = React.forwardRef<HTMLSpanElement, MorphingTextProps>(13 ({ words, className, interval = 3000, animationDuration = 0.5 }, ref) => {14 const [currentIndex, setCurrentIndex] = React.useState(0);1516 React.useEffect(() => {17 const timer = setInterval(() => {18 setCurrentIndex((prev) => (prev + 1) % words.length);19 }, interval);20 return () => clearInterval(timer);21 }, [words.length, interval]);2223 return (24 <span ref={ref} className={cn("relative inline-block", className)}>25 <AnimatePresence mode="wait">26 <motion.span27 key={currentIndex}28 initial={{ opacity: 0, y: 20, filter: "blur(8px)" }}29 animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}30 exit={{ opacity: 0, y: -20, filter: "blur(8px)" }}31 transition={{ duration: animationDuration, ease: "easeInOut" }}32 className="inline-block"33 >34 {words[currentIndex]}35 </motion.span>36 </AnimatePresence>37 </span>38 );39 },40);41MorphingText.displayName = "MorphingText";42export { MorphingText };
What it pulls in
npm packages
Files it writes
More from jolyui/ui
All 199 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-prompt-boxai-prompt-box | jolyui/ui | Components | Free | 4 deps | |
| animated-beamanimated-beam | jolyui/ui | Components | Free | 1 dep | |
| animated-tableanimated-table | jolyui/ui | Components | Free | 2 deps | |
| animated-theme-toggleanimated-theme-toggle | jolyui/ui | Components | Free | 2 deps | |
| animated-toastanimated-toast | jolyui/ui | Components | Free | 2 deps | |
| animated-tooltipanimated-tooltip | jolyui/ui | Components | Free | 1 dep | |
| bento-gridbento-grid | jolyui/ui | Components | Free | no deps | |
| buttonbutton | jolyui/ui | Components | Free | 3 deps |
