Glow Card Grid
ncdai/glow-card-gridUnverifiedComponent
Display cards with glowing border and background effects.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/exekartik/exeKartik/main/glow-card-grid.jsonSource
1"use client"23import { useEffect, useRef } from "react"45import { cn } from "@/lib/utils"67export type GlowCardGridProps = React.ComponentPropsWithoutRef<"div"> & {8 // Card parameters9 cardRadius?: number1011 // Icon parameters12 iconBlur?: number13 iconSaturate?: number14 iconBrightness?: number15 iconScale?: number16 iconOpacity?: number1718 // Border parameters19 borderWidth?: number20 borderBlur?: number21 borderSaturate?: number22 borderBrightness?: number23 borderContrast?: number2425 children: React.ReactNode26}2728export function GlowCardGrid({29 cardRadius = 16,3031 iconBlur = 25,32 iconSaturate = 5.0,33 iconBrightness = 1.3,34 iconScale = 4,35 iconOpacity = 0.3,3637 borderWidth = 3,38 borderBlur = 10,39 borderSaturate = 4.2,40 borderBrightness = 2.5,41 borderContrast = 2.5,4243 className,44 style,45 ...props46}: GlowCardGridProps) {47 const gridRef = useRef<HTMLDivElement>(null)4849 useEffect(() => {50 const handlePointerMove = (event: PointerEvent) => {51 if (!gridRef.current) return5253 const cards = gridRef.current.querySelectorAll<HTMLElement>(54 "[data-slot='glow-card']"55 )5657 cards.forEach((card) => {58 const rect = card.getBoundingClientRect()5960 const centerX = rect.left + rect.width / 261 const centerY = rect.top + rect.height / 26263 const x = (event.clientX - centerX) / (rect.width / 2)64 const y = (event.clientY - centerY) / (rect.height / 2)6566 card.style.setProperty("--pointer-x", x.toFixed(3))67 card.style.setProperty("--pointer-y", y.toFixed(3))68 })69 }7071 document.addEventListener("pointermove", handlePointerMove)7273 return () => document.removeEventListener("pointermove", handlePointerMove)74 }, [])7576 return (77 <div78 ref={gridRef}79 className={cn(80 "grid w-full gap-4 sm:grid-cols-2 md:grid-cols-3",81 className82 )}83 style={84 {85 "--card-radius": `${cardRadius}px`,86 "--card-icon-blur": `${iconBlur}px`,87 "--card-icon-saturate": iconSaturate,88 "--card-icon-brightness": iconBrightness,89 "--card-icon-scale": iconScale,90 "--card-icon-opacity": iconOpacity,91 "--card-border-width": `${borderWidth}px`,92 "--card-border-blur": `${borderBlur}px`,93 "--card-border-saturate": borderSaturate,94 "--card-border-brightness": borderBrightness,95 "--card-border-contrast": borderContrast,96 ...style,97 } as React.CSSProperties98// … truncated
Files it writes
More from ncdai
All 17 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Apple Hello Effectapple-hello-effect | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Hindiapple-hello-effect-hindi | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Spanishapple-hello-effect-spanish | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Vietnameseapple-hello-effect-vietnamese | ncdai | Components | Unverified | 1 dep | |
| Brand Assets Menubrand-assets-menu | ncdai | Components | Unverified | 1 dep | |
| chevrons-up-down-iconchevrons-up-down-icon | ncdai | Components | Unverified | 1 dep | |
| Code Block Commandcode-block-command | ncdai | Components | Unverified | 4 deps · 3 files | |
| Consent Managerconsent-manager | ncdai | Components | Unverified | 1 dep · 2 files |
