Components

Shiny Text

A shimmering text effect for React and Tailwind CSS: a band of light sweeps across the letters using a gradient clipped to the text. Pick the colors, speed, angle and direction, render any heading level with the as prop, and keep the text real and selectable for SEO.

  • SEO-friendly real text
  • background-clip: text
  • Heading levels via as
  • Loop or hover
  • prefers-reduced-motion

Introducing Dusk Pro

Installation

$ npx shadcn@latest add https://duskui.com/r/shiny-text.json

Usage

announcement.tsx
import { ShinyText } from "@/components/dusk/text/shiny-text"

export function Announcement() {
  return (
    <ShinyText as="h2" className="text-4xl font-bold">
      Now in public beta
    </ShinyText>
  )
}

Examples

Colors, speed & direction

color is the base text color and shineColor the band. spread sets the band width, angle its slant, direction the sweep direction, and duration / repeatDelay the rhythm.

Mint sweep

Slow gold

Right to left

Loading text

A fast, narrow sweep makes a calm loading label. Pass role="status" so the message is announced.

Generating your component…

Sweep on hover

trigger="hover" plays a single sweep each time the pointer enters, good for links and announcement pills.

API Reference

Also accepts any HTML attribute for the rendered element.

PropTypeDefaultDescription
as"span" | "p" | "div" | "strong" | "em" | "h1" … "h6""span"Element to render. Use a heading level for titles.
colorstringforeground at 55%Base text color (any CSS color).
shineColorstringvar(--color-foreground)Color of the light band.
durationnumber1.8Seconds for one sweep.
repeatDelaynumber2.5Seconds between sweeps in loop mode.
spreadnumber0.35Band width as a fraction of the text width (0.1–1).
anglenumber110Band angle in degrees.
direction"ltr" | "rtl""ltr"Sweep direction.
trigger"loop" | "hover""loop"Sweep continuously or once per hover.

Accessibility

  • The text is a single real element with no duplicated copies, so it is selectable, translatable and indexed like any heading.
  • Use as to keep the correct heading level in the document outline.
  • Selected text switches to a solid color so it stays legible, and forced-colors (high contrast) modes fall back to the system text color.
  • The shine moves outside React, and only the background position animates.
  • With prefers-reduced-motion the text is static in its base color. Pick a base color with enough contrast on its own.