Dia Text Reveal

A sweeping gradient text reveal with viewport triggering and rotating text support.

motion-sv
Joy of Code

Installation

pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/dia-text-reveal.json

Usage

<script lang="ts">	import { DiaTextReveal } from "#lib/components/magic/dia-text-reveal/index.js";</script>
<div class="flex min-h-40 items-center justify-center">	<DiaTextReveal		text="Joy of Code"		class="pb-1 text-4xl font-semibold sm:text-6xl"	/></div>

Examples

Custom Gradient

Design systems

Rotating Phrases

Learn to build faster

Duration and Delay

Adjust the sweep duration and delay before starting.

Made with care

Props

Dia Text Reveal

A component for revealing text with a moving gradient sweep.

NameTypeDefaultDescription
textstring | string[]requiredText to reveal. Pass multiple strings to rotate when repeat is enabled.
colorsstring[]["#c679c4", "#fa3d1d", "#ffb005", "#e1e1fe", "#0358f7"]Colors sampled across the moving gradient band.
textColorstring"var(--foreground)"CSS color for revealed text after the sweep.
durationnumber1.5Duration of one sweep pass in seconds.
delaynumber0Delay before the sweep starts in seconds.
repeatbooleanfalseReplay the sweep and advance to the next string after each completion.
repeatDelaynumber0.5Pause between repeated cycles in seconds.
triggerOnViewbooleantrueStart the reveal when the component enters the viewport.
oncebooleantrueWhen using triggerOnView, run only on the first viewport entry.
fixedWidthbooleanfalseUse the widest string width instead of animating width between strings.
classClassValue""Additional CSS classes to apply to the animated span.