Modus UI

Gradient Text

Web (React)

Seamlessly looping animated gradient text that can optionally wrap its borders.

Seamlessly looping animated gradient text driven by framer-motion animation frames. Includes support for horizontal, vertical, and diagonal sweeps, and an optional gradient border tracing mode.

Fluid Gradient TextWith Glowing Gradient Border

Installation

CLI

npx @modus-ui/cli add gradient-text

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/gradient-text.tsx.
  3. Paste the code.

Usage

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

export default function Example() {
  return (
    <GradientText
      className="text-4xl font-bold"
      colors={[
        "hsl(var(--primary))",
        "hsl(var(--primary))",
        "hsl(var(--primary))",
        "hsl(var(--primary))",
      ]}
      animationSpeed={5}
    >
      Fluid Gradient Text
    </GradientText>
  );
}

Props

PropTypeDefaultDescription
colorsstring[]["hsl(var(--primary))", "hsl(var(--primary))", "hsl(var(--primary))", "hsl(var(--primary))", "hsl(var(--primary))"]Colours of the gradient.
animationSpeednumber8Seconds for one gradient cycle.
showBorderbooleanfalseAdds an animated gradient border.
direction"horizontal" | "vertical" | "diagonal""horizontal"Direction the gradient moves.
pauseOnHoverbooleanfalsePauses the animation while hovered.
yoyobooleantrueReverses the animation each cycle instead of looping.

Comments

  • No comments yet.