Text Shimmer

Texte avec un remplissage en degrade anime qui scintille. Installez Text Shimmer depuis le registre VLLNT UI avec la CLI shadcn.

Signaler un bug

Texte avec un remplissage en degrade anime qui scintille. Fait partie de la famille content dans VLLNT UI, il est publie comme entree de registre lisible par machine — copiez la source directement dans votre application avec la CLI shadcn et possedez-la, sans dependance d'execution a une bibliotheque de composants.

Apercu

Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.

Installation

Ajoutez Text Shimmer a votre projet avec la CLI shadcn. La source arrive dans votre code, prete a etre adaptee :

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/text-shimmer.json

Source

import * as React from "react"; import { cn } from "../../lib/utils"; /** Props for {@link TextShimmer}. */ export type TextShimmerProps = React.ComponentPropsWithoutRef<"span"> & { /** Content rendered with the moving gradient fill. */ children: React.ReactNode; /** Seconds for one gradient sweep. Defaults to `2`. */ duration?: number; }; /** * Text filled with a gradient that drifts across the glyphs on a loop. * * Respects `prefers-reduced-motion`: the gradient holds still. * * @example * ```tsx * <TextShimmer>Premium</TextShimmer> * ``` */ export const TextShimmer = ({ children, className, duration = 2, ref, style, ...props }: TextShimmerProps & { ref?: React.Ref<HTMLSpanElement> }) => { return ( <span className={cn( "inline-block animate-[vllnt-text-shimmer_linear_infinite] bg-clip-text text-transparent motion-reduce:animate-none", className, )} ref={ref} style={{ animationDuration: `${duration}s`, background: "linear-gradient(90deg, oklch(var(--muted-foreground) / 0.5), oklch(var(--foreground)), oklch(var(--muted-foreground) / 0.5))", backgroundSize: "200% auto", ...style, }} {...props} > {children} </span> ); }; TextShimmer.displayName = "TextShimmer";

Stories

Explorez chaque variante et etat dans le Storybook interactif :

Apercu

Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.

Dependances

  • @vllnt/ui@^0.3.0