Encrypted Text
A continuously scrambling cipher that decrypts from left to right into a readable message while keeping every character locked in place.
Installation#
pnpm dlx shadcn@latest add @davinciui/encrypted-textUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
textThe readable value revealed at the end of each cycle. | string | "DAVINCIUI" |
charactersCharacters sampled while the value is encrypted. | string | "A-Z, 0-9 and symbols" |
scrambleDurationTime spent fully encrypted before decryption starts, in milliseconds. | number | 520 |
revealDurationDuration of the left-to-right decryption, in milliseconds. | number | 1100 |
holdDurationTime the readable value remains visible, in milliseconds. | number | 1500 |
loopRepeat the encryption and decryption sequence. | boolean | true |
encryptedColorColor of unresolved cipher characters. | string | "#5f845c" |
revealedColorColor of resolved characters. | string | "currentColor" |
fontSizeFont size. Numbers become px; strings pass through. | number | string | 80 |
fontWeightFont weight applied to every character. | number | 700 |
letterSpacingSpacing between cipher characters. | number | string | "0.08em" |
fontFamilyFont family applied to every character. | string | "ui-monospace, ..." |
classNameAdditional classes for the outer element. | string | — |
Accessibility#
The outer span carries aria-label with the final text while the scrambling characters are aria-hidden, so screen readers never hear cipher noise. The value is not a live region, so the resolved message is not re-announced when a cycle completes.
Motion#
A requestAnimationFrame loop rewrites characters about every 42ms; scrambleDuration, revealDuration, holdDuration, and loop control the cycle with no easing options. It checks prefers-reduced-motion and immediately renders the resolved text, resuming when the preference clears.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

