Ballmac UI home

Magic Card

A card with a two-color light that follows the pointer along its border, with an optional soft glow inside, driven by CSS variables so moving never re-renders, and a steady light on keyboard focus.

Fast by default

Every component ships with the smallest runtime it can.

Composable

Small parts that fit together instead of one giant API.

Accessible

Keyboard and screen reader support is part of the code.

Installation

$ pnpm dlx shadcn@latest add @ballmac/magic-card

Usage

import { MagicCard } from "@/components/ballmac/magic-card"

The full example is in the Code tab above.

Examples

Color pairs

chart-1 → chart-4

Move over me

chart-2 → chart-1

Move over me

chart-3 → chart-5

Move over me

chart-4 → chart-3

Move over me

API reference

PropTypeDefault
size

Radius of the light that follows the pointer, in pixels.

number260
from

First color of the border light.

MagicTone"chart-1"
to

Second color of the border light.

MagicTone"chart-4"
glow

Also light the inside of the card faintly.

booleantrue
contentClassName

Classes for the inner surface.

string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
FocusA centered light shows when anything inside has focus
Reduced motionNo pointer tracking; a plain border remains

Use with AI

<MagicCard from to size glow contentClassName>content</MagicCard>. from and to are chart tokens. Use spotlight-card for a single soft glow and this for a colored border light. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Magic Card (@ballmac/magic-card) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Feature and pricing cards on dark or light pages
  • Any card grid that should feel responsive to the pointer

Not for

  • Dense data UI
  • Cards that are not interactive

Registry JSON: https://ui.ballmac.com/r/magic-card.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils