ComponentsCard Background Shine

Card Background Shine

Luxe

Explore the new website that simplifies the creation of sophisticated dark mode components.

Terminal
npm i clsx tailwind-merge
utils/cn.ts
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}
CardBackgroundShine.tsx
import { cn } from "@/utils/cn";

export function CardBackgroundShine() {
  return (
    <div
      className={cn(
        "inline-flex w-full max-w-[350px] animate-shine items-center justify-center rounded-xl border",
        "border-white/10 bg-[linear-gradient(110deg,#000000,45%,#303030,55%,#000000)] bg-[length:400%_100%]",
        "px-4 py-5 text-sm transition-colors dark:bg-[linear-gradient(110deg,#000103,45%,#303030,55%,#000103)]",
      )}
    >
      <div className="flex flex-col gap-2">
        <h3 className="text-xl font-semibold text-neutral-100 dark:text-neutral-200">
          Luxe
        </h3>
        <p className="text-sm leading-[1.5] text-neutral-200 dark:text-neutral-400">
          Explore the new website that simplifies the creation of sophisticated
          dark mode components.
        </p>
      </div>
    </div>
  );
}
tailwind.config.ts
{
  "animation": {
    "shine": "shine 6s linear infinite"
  },
  "keyframes": {
    "shine": {
      "from": {
        "backgroundPosition": "0 0"
      },
      "to": {
        "backgroundPosition": "-400% 0"
      }
    }
  }
}