Updated
Redact and Reveal
Customize
Sweep300ms
Stagger40ms
Move420ms
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/redact-reveal.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/redact-reveal/redact-reveal.tsx"use client"; import { cn } from "@/lib/utils"; import { AnimatePresence, motion } from "motion/react"; import { useEffect, useState } from "react"; // `play` counts presses of a card's Change button. 0 means the card has not // been pressed yet, so every effect renders its resting state without // animating on page load. export type EffectProps = { play: number }; // Size comes from --text-effect-size (default 1.25rem, i.e. text-xl), so a // preview can enlarge every effect without changing the installed default. const SIZE = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4]"; const TEXT = `${SIZE} text-zinc-700 font-medium dark:text-zinc-200`; // The entry for the nth press, wrapping around the list. const pick = <T,>(list: T[], play: number) => list[((play % list.length) + list.length) % list.length]; // 24 — Bars sweep across each word like a classified file. Once every word // is fully covered the text is hidden, and only then do the bars move onto // the next sentence with layout animations: bars that stay resize to their // new word, bars no longer needed shrink to zero width, and bars for new
Adds the files to
components/uibrik/redact-reveal and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/redact-reveal.Usage
import { RedactReveal } from "@/components/uibrik/redact-reveal/redact-reveal";const lines = ["The plan is still on", "Meet me after the rain tonight", "Burn this note"];<RedactReveal play={0} lines={lines} sweep={300} stagger={40} move={420}/>Where to use Redact and Reveal
Security and privacy heroes
Black bars redacting a line then lifting to reveal the next suits privacy brands.
Editorial sites
A redaction effect fits investigative journalism and reports.
Rotating phrases
Each reveal swaps in the next message with a strong visual cue.
Pairs with Scramble to Word
Props
RedactReveal- lines
- Type string[]
- ["The plan is still on","Meet me after the rain tonight","Burn this note"]
- Cycled through, one per play.
- sweep
- Type number
- 300
- Time for one bar to cover or peel.
- stagger
- Type number
- 40
- Delay between neighbouring bars.
- move
- Type number
- 420
- Time for bars to travel onto the next line.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.