Hover Glow Card

PreviousNext

Card with glow effect on hover

Docs
animbitscomponent

Preview

Loading preview…
registry/new-york/animations/cards/hover-glow.tsx
"use client";
import * as React from "react";
import { motion, HTMLMotionProps } from "motion/react";
import { cn } from "@/lib/utils";
import { useHoverGlow } from "@/lib/use-hover-glow";
export interface CardHoverGlowProps extends HTMLMotionProps<"div"> {
  glowColor?: string;
  glowSpread?: number;
  duration?: number;
}
export function CardHoverGlow({
  children,
  className,
  glowColor = "rgba(59, 130, 246, 0.5)",
  glowSpread = 20,
  duration = 0.3,
  ...props
}: CardHoverGlowProps) {
  const glowProps = useHoverGlow({
    glowColor,
    glowBlur: glowSpread,
    duration,
  });
  return (
    <motion.div
      {...glowProps}
      className={cn("cursor-pointer", className)}
      {...props}
    >
      {children}
    </motion.div>
  );
}

Installation

npx shadcn@latest add @animbits/cards-hover-glow

Usage

import { CardsHoverGlow } from "@/components/cards-hover-glow"
<CardsHoverGlow />