"use client"; import {motion, type Transition} from "motion/react"; import * as React from "react"; import {cn} from "@/lib/utilities"; import styles from "./gradient-text.module.css"; /** Props accepted by {@link GradientText}. */ export interface GradientTextProps extends React.HTMLAttributes { /** Text content rendered with the animated gradient fill. @default undefined */ text: string; /** CSS gradient string assigned to the animated text fill. @default "linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)" */ gradient?: string; /** Adds a blurred neon duplicate behind the primary text layer. @default false */ neon?: boolean; /** Motion timing used for the animated gradient background. @default {duration: 50, repeat: Infinity, ease: "linear"} */ transition?: Transition; } type GradientStyleProperties = React.CSSProperties & { "--ac-gradient-text-background": string; }; /** * Renders animated gradient-filled text with an optional neon glow layer. * * @remarks * - Animated component using the `motion` library * - Renders a `` element * - Styling via CSS Modules with `--ac-*` custom properties * - Client-side only (`"use client"` directive) * * @example * ```tsx * * ``` * * @see {@link GradientTextProps} for available props */ const GradientText = React.forwardRef( ( { text, className, gradient = "linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)", neon = false, transition = {duration: 50, repeat: Infinity, ease: "linear"}, ...props }, ref, ) => { const baseStyle: GradientStyleProperties = { "--ac-gradient-text-background": gradient, }; return ( {text} {neon ? ( ) : null} ); }, ); GradientText.displayName = "GradientText"; export {GradientText};