BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/jolyui/ui/shutter-text

shutter-text

jolyui-ui/shutter-text
FreeComponent

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/shutter-text.json

Source

ui/shutter-text.tsxjolyui.dev/r/shutter-text.json
1"use client";
2
3import { AnimatePresence, motion, useInView } from "framer-motion";
4import {
5 type HTMLAttributes,
6 useCallback,
7 useEffect,
8 useRef,
9 useState,
10} from "react";
11
12interface ShutterTextProps extends HTMLAttributes<HTMLDivElement> {
13 text?: string;
14 trigger?: "auto" | "scroll" | "click" | "hover";
15}
16
17export default function ShutterText({
18 text = "IMMERSE",
19 trigger = "auto",
20 className = "",
21 ...props
22}: ShutterTextProps) {
23 const [count, setCount] = useState(0);
24 const [active, setActive] = useState(
25 trigger === "auto" || trigger === "click" || trigger === "hover",
26 );
27 const [animating, setAnimating] = useState(trigger === "auto");
28 const ref = useRef<HTMLDivElement>(null);
29 const isInView = useInView(ref, { once: false, amount: 0.5 });
30 const characters = text.split("");
31
32 // Handle scroll trigger
33 useEffect(() => {
34 if (trigger === "scroll" && isInView) {
35 setActive(true);
36 setAnimating(true);
37 setCount((c) => c + 1);
38 }
39 if (trigger === "scroll" && !isInView) {
40 setActive(false);
41 setAnimating(false);
42 }
43 }, [trigger, isInView]);
44
45 // Handle auto trigger – animate once on mount
46 useEffect(() => {
47 if (trigger === "auto") {
48 setActive(true);
49 setAnimating(true);
50 setCount((c) => c + 1);
51 }
52 }, [trigger]);
53
54 const handleClick = useCallback(() => {
55 if (trigger === "click") {
56 setAnimating(true);
57 setCount((c) => c + 1);
58 }
59 }, [trigger]);
60
61 const handleMouseEnter = useCallback(() => {
62 if (trigger === "hover") {
63 setAnimating(true);
64 setCount((c) => c + 1);
65 }
66 }, [trigger]);
67
68 const handleMouseLeave = useCallback(() => {
69 if (trigger === "hover") {
70 setAnimating(false);
71 }
72 }, [trigger]);
73
74 return (
75 <div
76 ref={ref}
77 role="button"
78 tabIndex={0}
79 onClick={handleClick}
80 onMouseEnter={handleMouseEnter}
81 onMouseLeave={handleMouseLeave}
82 className={`relative inline-flex flex-wrap items-center justify-center ${className}`}
83 {...props}
84 >
85 <AnimatePresence mode="wait">
86 {animating ? (
87 <motion.span
88 key={count}
89 className="flex flex-wrap items-center justify-center"
90 >
91 {characters.map((char, i) => (
92 <span
93 key={i}
94 className="relative inline-block overflow-hidden px-[0.1vw]"
95 >
96 {/* Main Character */}
97 <motion.span
98// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • ui/shutter-text.tsx

Facts

Registry
jolyui/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on jolyui/ui jolyui.dev Johuniq/jolyui on GitHub Raw registry item This item as JSON

More from jolyui/ui

All 199 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-prompt-boxai-prompt-boxjolyui/uiComponentsFree4 deps
animated-beamanimated-beamjolyui/uiComponentsFree1 dep
animated-tableanimated-tablejolyui/uiComponentsFree2 deps
animated-theme-toggleanimated-theme-togglejolyui/uiComponentsFree2 deps
animated-toastanimated-toastjolyui/uiComponentsFree2 deps
animated-tooltipanimated-tooltipjolyui/uiComponentsFree1 dep
bento-gridbento-gridjolyui/uiComponentsFreeno deps
buttonbuttonjolyui/uiComponentsFree3 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex