Shader Text
Animated WebGL fragment shaders clipped inside text glyphs via a dynamic SVG mask. Twelve GLSL presets — noise, plasma, aurora, cyber and more — flow continuously inside razor-sharp type with GPU-accelerated rendering.
Installation#
pnpm dlx shadcn@latest add @davinciui/shader-textUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
textText rendered into the SVG glyph mask. Supports multiline via \n. | string | "Shader" |
fontFamilyFont family shared by the sizing node and the SVG mask so glyphs align exactly. | string | 'Inter, "Helvetica Neue", Arial, sans-serif' |
fontSizeFont size in CSS px. | number | 120 |
fontWeightFont weight applied to the sizing node and mask. | number | string | 800 |
fontStyleFont style (e.g. normal or italic). | string | "normal" |
letterSpacingTracking in CSS px. | number | 0 |
lineHeightUnitless line-height multiplier for multiline text. | number | 1 |
textAlignHorizontal alignment of each line. | "left" | "center" | "right" | "center" |
presetFragment-shader preset. Each value compiles a different GLSL program (case-insensitive). | "noise" | "plasma" | "aurora" | "cyber" | "lava" | "ocean" | "sunset" | "nebula" | "prism" | "glitch" | "bloom" | "void" | "aurora" |
speedAnimation speed multiplier driving u_time. | number | 1 |
scaleShader pattern zoom passed as u_scale. | number | 1.6 |
resolutionCanvas backing-store multiplier on top of devicePixelRatio (0.25–2). | number | 1 |
softnessPattern softness 0–1 passed as u_softness; reshapes transitions inside the shader. | number | 0.5 |
ariaLabelAccessible label override. Defaults to the text. | string | — |
classNameAdditional classes for the outer wrapper. | string | — |
Accessibility#
The root is role img with an aria-label defaulting to the text, while the canvas and sizing node are aria-hidden. There is no keyboard interaction, and WebGL failure falls back to readable static text with the same role and label.
Motion#
A continuous WebGL fragment shader animates inside the glyph mask; speed scales shader time, while preset, scale, and softness change the pattern. A matchMedia listener freezes rendering to a static frame for prefers-reduced-motion, and animation pauses offscreen or in hidden tabs.
Known constraints#
- The shader fill needs WebGL. Without it the effect is skipped rather than replaced by an image.
- Rendering pauses when the element is offscreen or the page is hidden.
- Reduced motion keeps the text readable but stops the animated fill.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

