Magic Card

A spotlight that follows the pointer and highlights the border on hover — gradient fill or soft orb glow.

Default

Gradient spotlight that follows the pointer. Pass gradientColor for light and dark surfaces.

Loading…

Installation

CLI
npx @sonojs/ui@latest add magic-card
Also needs
npm i motion

Usage

page.tsx
import { MagicCard } from "@/components/magic-card"

export function Example() {
  return (
    <MagicCard>
      <div className="p-4">
        <p>Hello World</p>
        <span>Hover me</span>
      </div>
    </MagicCard>
  )
}

Props

PropTypeDefaultDescription
childrenReact.ReactNode-Content rendered inside the card.
classNamestring-Extra classes on the card root.
mode"gradient" · "orb""gradient"Spotlight style: gradient wash or orb glow.
gradientSizenumber200Radius of the gradient spotlight in pixels.
gradientColorstring"#262626"Fill color of the gradient spotlight (gradient mode).
gradientOpacitynumber0.8Opacity of the gradient spotlight (gradient mode).
gradientFromstring"#9E7AFF"Start color of the border gradient.
gradientTostring"#FE8BBB"End color of the border gradient.
glowFromstring"#ee4f27"Orb glow start color (orb mode).
glowTostring"#6b21ef"Orb glow end color (orb mode).
glowAnglenumber90Orb glow gradient angle in degrees (orb mode).
glowSizenumber420Orb glow diameter in pixels (orb mode).
glowBlurnumber60Orb glow blur in pixels (orb mode).
glowOpacitynumber0.9Orb glow opacity while hovered (orb mode).