OfferLifetime Pro for $99

Gradient Text

The gradient is a background clipped to the letters, so the text stays selectable and searchable. The default colours come from the theme, and it falls back to a solid colour where clipping is not supported.

CreativeFree113 lines · one file

The decision inside it

Sweep once, then rest

A headline that keeps moving while someone reads is a distraction; the sweep catches the eye once as it scrolls in and then stays still.

When to use it

Use Gradient Text for a few words in a headline that should carry the brand's colour: still, slowly flowing, or swept once as it scrolls in. Keep it to a phrase, not a paragraph.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Gradient Text for this.
Install it: npx shadcn@latest add @layro/gradient-text
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/gradient-text.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/hero-heading.tsx
import { GradientText } from "@/components/ui/gradient-text";

export function HeroHeading() {
  return (
    <h1 className="text-5xl font-semibold">
      Contracts signed <GradientText animate="sweep-once">before the meeting ends.</GradientText>
    </h1>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
childrenrequiredReact.ReactNode—
colorsstring[]Two or more CSS colours. Default the theme's info and success hues.
animate"none" | "flow" | "sweep-once""none", "flow" (keeps moving), or "sweep-once" (one pass when it comes into view). Default "none".
speednumberSeconds for one pass of the gradient. Default 6 for flow, 1.4 for sweep-once.
asReact.ElementTypeThe element to render. Default "span".

Dependencies

npm packages

clsxtailwind-merge

Layro foundations, installed alongside it

layro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Still
  • Flow
  • Sweep once
  • Reduced motion

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.