Glow Card
nyxui/glow-cardFreeComponent
A glow card that that provide several effects.
Live preview
live · rendered by the registry
Rendered by shadcn/ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://nyxui.com/r/glow-card.jsonSource
1"use client";2import type React from "react";3import { useRef, useEffect, useState, useCallback, useMemo } from "react";4import { cn } from "@/lib/utils";56interface Particle {7 id: number;8 x: number;9 y: number;10 vx: number;11 vy: number;12 size: number;13 life: number;14 color: string;15}1617interface GlowCardProps {18 children: React.ReactNode;19 className?: string;20 variant?: "liquid" | "laser" | "cosmic" | "glitch";21 intensity?: number;22 liquidColor?: string;23 laserColor?: string;24 glitchColor1?: string;25 glitchColor2?: string;26 disabled?: boolean;27 allowCustomBackground?: boolean;28}2930export function GlowCard({31 children,32 className,33 variant = "liquid",34 intensity = 0.8,35 liquidColor = "#3b82f6",36 laserColor = "#ff0000",37 glitchColor1 = "#ff0064",38 glitchColor2 = "#00ff64",39 disabled = false,40 allowCustomBackground = false,41 ...props42}: GlowCardProps & React.HTMLAttributes<HTMLDivElement>) {43 const containerRef = useRef<HTMLDivElement>(null);44 const animationRef = useRef<number>(0);45 const waveTimeRef = useRef<number>(0);46 const frameCountRef = useRef<number>(0);47 const lastMouseMoveRef = useRef<number>(0);48 const intersectionRef = useRef<IntersectionObserver | null>(null);49 const [isHovered, setIsHovered] = useState(false);50 const [isVisible, setIsVisible] = useState(false);51 const [mousePos, setMousePos] = useState({ x: 50, y: 50 });52 const [particles, setParticles] = useState<Particle[]>([]);53 const [ripples, setRipples] = useState<54 Array<{ id: number; x: number; y: number; time: number }>55 >([]);56 const [glitchOffset, setGlitchOffset] = useState({ x: 0, y: 0 });57 const colorData = useMemo(() => {58 const hexToRgb = (hex: string) => {59 const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);60 return result61 ? {62 r: Number.parseInt(result[1], 16),63 g: Number.parseInt(result[2], 16),64 b: Number.parseInt(result[3], 16),65 }66 : { r: 59, g: 130, b: 246 };67 };6869 return {70 rgb: hexToRgb(liquidColor),71 laserRgb: hexToRgb(laserColor),72 glitch1Rgb: hexToRgb(glitchColor1),73 glitch2Rgb: hexToRgb(glitchColor2),74 };75 }, [liquidColor, laserColor, glitchColor1, glitchColor2]);7677 // Generate cosmic particles78 const generateCosmicParticles = useCallback(79 (centerX: number, centerY: number) => {80 const newParticles: Particle[] = [];81 for (let i = 0; i < 10; i++) {82// … truncated
Files it writes
More from shadcn/ui
All 68 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3D Layered Card3d-layered-card | shadcn/ui | Components | Free | 1 dep | |
| Animated Code Blockanimated-code-block | shadcn/ui | Components | Free | 3 deps | |
| Animated Grainy Backgroundanimated-grainy-bg | shadcn/ui | Components | Free | 1 dep | |
| Animated Textanimated-text | shadcn/ui | Components | Free | 1 dep | |
| Apple Glass Effectapple-glass-effect | shadcn/ui | Components | Free | 1 dep | |
| Bubble Backgroundbubble-background | shadcn/ui | Components | Free | no deps | |
| Custom Cursorcustom-cursor | shadcn/ui | Components | Free | 1 dep | |
| Cyberpunk Cardcyberpunk-card | shadcn/ui | Components | Free | no deps |
