Shake Text
A premium 3D layered text effect with four colored depth copies that move continuously behind a stable foreground.
Installation#
pnpm dlx shadcn@latest add @davinciui/shake-textUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
textText rendered in the front layer and every depth layer. | string | "DAVINCIUI" |
asSemantic tag for the accessible front layer. Depth layers are always aria-hidden. | "h1" | "h2" | "h3" | "span" | "div" | "h1" |
fontFamilyFont family for every layer. | string | "Inter, sans-serif" |
fontSizeFont size. Numbers become px; strings pass through. Depth offsets scale with it. | number | string | 137 |
fontWeightFont weight for every layer. | number | 900 |
letterSpacingLetter spacing. Numbers become px. | number | string | 0 |
frontColorFront layer color. | string | "#fff8e7" |
layerColorsBack-to-front colors for the four depth layers. | [string, string, string, string] | teal / green / coral / yellow |
depthZ-depth step per layer in px at the 137px reference size. | number | 5 |
layerOffsetVertical offset step per layer in px at the 137px reference size. | number | 4 |
perspectiveCSS perspective of the wrapper in px. | number | 1000 |
shakeIntensityMultiplier for the shake keyframes. | number | 1 |
shakeDurationDuration of one continuous motion cycle in seconds. | number | 1.4 |
shakeRepeatExtra timeline repeats for a manual shake. | number | 0 |
triggerContinuously animate or wait for shake() through the component ref. | "loop" | "manual" | "loop" |
autoPlayStart the continuous loop automatically. | boolean | true |
classNameExtra classes for the outer wrapper. | string | — |
textClassNameExtra classes applied to the front text layer. | string | — |
Accessibility#
The semantic front layer, such as h1 or span, is exposed with the text, while all four colored depth copies are aria-hidden. There are no keyboard controls; the continuous loop and imperative shake handle are motion-only, and reduced-motion users get a static front layer.
Motion#
Four ghost layers translate, rotate, and skew through GSAP sine.inOut timelines behind a stationary front layer; shakeIntensity, shakeDuration, shakeRepeat, trigger, and autoPlay control it. A matchMedia listener stops autoplay and makes shake a no-op when prefers-reduced-motion is set.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

