Updated
Scramble Text
ScrambleText
Customize
Duration1.0s
Stagger0.07s
Blur4px
Scramble speed0.9
Mixed case
Installation
npx shadcn@latest add https://uibrik.com/r/scramble-text.jsonInstall the packages
npm install @gsap/react gsapCopy the source into your project
components/uibrik/scramble-text/scramble-text.tsx"use client"; import { useRef } from "react"; import { gsap } from "gsap"; import { useGSAP } from "@gsap/react"; import { ScrambleTextPlugin } from "gsap/ScrambleTextPlugin"; gsap.registerPlugin(ScrambleTextPlugin); export type ScrambleCharacters = "upperAndLowerCase" | "upperCase" | "lowerCase" | "numbers" | "symbols"; const CHARACTER_SETS: Record<ScrambleCharacters, string> = { upperAndLowerCase: "upperAndLowerCase", upperCase: "upperCase", lowerCase: "lowerCase", numbers: "0123456789", symbols: "!<>-_\\/[]{}=+*^?#", }; export type ScrambleTextProps = { text: string; className?: string; /** Seconds each letter takes to settle. */ duration?: number;
Adds the files to
components/uibrik/scramble-text and installs @gsap/react and gsap. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/scramble-text.Usage
import { ScrambleText } from "@/components/uibrik/scramble-text/scramble-text";<ScrambleText text="Scramble Text" duration={1} stagger={0.07} blur={4} scrambleSpeed={0.9} characters="upperAndLowerCase"/>Where to use Scramble Text
Security product heroes
Letters resolving from random characters suit encryption and security brands.
Pairs with Lean and Scramble
Terminal-style sites
A decoding effect fits developer and hacker aesthetics.
Pairs with Terminal Demo
Section titles on load
Characters settling one after another draw attention to a heading.
Props
ScrambleText- text
- Type string
- "Scramble Text"
- Text to reveal.
- duration
- Type number
- 1
- Seconds each letter takes to settle.
- stagger
- Type number
- 0.07
- Delay between letters.
- blur
- Type number
- 4
- Starting blur.
- scrambleSpeed
- Type number
- 0.9
- How fast the random characters cycle.
- characters
- Type "upperAndLowerCase" | "upperCase" | "lowerCase" | "numbers" | "symbols"
- "upperAndLowerCase"
- Which characters flicker before each letter lands.
- className
- Type string
- –
- Wrapper classes; text colour and size are inherited.