Gradient Text
Words filled with a gradient: still, slowly flowing, or swept once when they come into view.
- Category
- Creative
- Access
- Free with an account
- Source
- 113 lines · one file
- States
- 4 drawn
- Added
- 21 Oct 2026
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 Liro's Gradient Text for this.
Install it: npx shadcn@latest add @liro/gradient-text
(the @liro registry is set up in components.json, with LIRO_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 @liro registry with your CLI token: see the Namespaced tab.
Usage
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.
| Type | Notes | ||
|---|---|---|---|
children | React.ReactNode | Yes | – |
colors | string[] | No | Two or more CSS colours. Default the theme's info and success hues. |
animate | "none" | "flow" | "sweep-once" | No | "none", "flow" (keeps moving), or "sweep-once" (one pass when it comes into view). Default "none". |
speed | number | No | Seconds for one pass of the gradient. Default 6 for flow, 1.4 for sweep-once. |
as | React.ElementType | No | The element to render. Default "span". |
Dependencies
npm packages
clsxtailwind-mergeLiro foundations, installed alongside it
liro-themeStates
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