Magic Card
Card whose border and surface light up under the pointer or keyboard focus.
pnpm dlx @glinui/cli@latest add magic-card$24/ seat
- Unlimited projects
- Priority support
- Audit log export
Installation
pnpm dlx @glinui/cli@latest add magic-cardCredits. Adapted from Magic UI (MIT, (c) Magic UI). Removed motion and next-themes, CSS variables written on animation frames, token colors, fine pointer gating and a glass variant. Attribution details.
Prefer the package?
Usage
Overlap verdict versus SpotlightCard: about 40 percent. SpotlightCard is a glass-only soft spotlight. MagicCard also lights the border, works on the solid token surface and activates on keyboard focus, so both stay. Use SpotlightCard for a pure glass glow and MagicCard for border-follow grids.
The pointer effect only runs on fine pointers `(hover: hover) and (pointer: fine)`. Touch and coarse pointers get a static card.
Variants
glinr is the default, plain is flat shadcn, solid is a neutral tonal face, glass is opt-in and needs a backdrop.
glinr
Crisp on any stage.
Learn moreplain
Crisp on any stage.
Learn moresolid
Crisp on any stage.
Learn moreglass
Opt-in. Needs a backdrop.
Learn moreimport { MagicCard } from "@glinui/ui"
// Omit `variant` to follow the ambient style (glinr by default).export function MagicCardVariants() { return ( <> <MagicCard variant="glinr"> ... </MagicCard> <MagicCard variant="plain"> ... </MagicCard> <MagicCard variant="solid"> ... </MagicCard> <MagicCard variant="glass"> ... </MagicCard> </> )}Colors
`gradientFrom`, `gradientTo` and `gradientColor` take any token.
accent
The effect color follows the tone token.
Learn moresuccess
The effect color follows the tone token.
Learn morewarning
The effect color follows the tone token.
Learn moredanger
The effect color follows the tone token.
Learn moreinfo
The effect color follows the tone token.
Learn moreimport { MagicCard } from "@glinui/ui"
export function MagicCardTones() { return ( <MagicCard gradientFrom="var(--tone-success)" gradientColor="color-mix(in oklab, var(--tone-success) 24%, transparent)"> ... </MagicCard> )}In a layout
A pricing row where the highlighted plan is a MagicCard.
$0/ seat
- Unlimited projects
- Priority support
- Audit log export
$24/ seat
- Unlimited projects
- Priority support
- Audit log export
$60/ seat
- Unlimited projects
- Priority support
- Audit log export
// A pricing row where the highlighted plan is a MagicCard.import { MagicCard } from "@glinui/ui"
export function MagicCardLayout() { return ( <section className="grid gap-4 sm:grid-cols-3"> ... </section> )}Accessibility
- Decorative layers are aria-hidden and pointer-events-none, so nested links and buttons stay clickable.
- Content sits above the layers in DOM and paint order. Reading order is untouched.
- Keyboard focus inside the card lights it from the center, so the effect is not pointer only.
ARIA Attributes
- `data-active` mirrors the lit state for styling
- Decorative spans use `aria-hidden="true"`
Reduced Motion
With motion level none, subtle or prefers-reduced-motion the card is fully static: no tracking, no highlight layers shown.
Affected properties
pointer-follow spotlightborder highlightopacity transitionsAPI Reference
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | SurfaceVariant | "default" | - | ambient (glinr) | Base surface from the Card vocabulary. Glass is opt-in. |
autoPlay | boolean | No | false | Loops a slow synthetic pointer (demos, screenshots, touch). Needs motion level full. |
gradientSize | number | No | 280 | Radius in pixels of the spotlight and the border highlight. |
gradientColor | string | No | accent tint | Spotlight fill color. |
gradientFrom | string | No | var(--color-accent) | Border highlight start color. |
gradientTo | string | No | var(--color-signal-ok) | Border highlight end color. |
...CardProps | CardProps | - | - | size, elevation and every div attribute are forwarded to Card. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { MagicCard } from "@glinui/ui"Dependencies
@glinui/ui@glinui/motionGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/magic-card.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
MagicCardProps
MagicCardProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
autoPlay | boolean | No | false | Runs a slow looping synthetic pointer so the highlight is visible without hovering (demos, screenshots, touch). Needs motion level full. A real pointer takes over while hovering. |
gradientColor | string | No | - | Spotlight fill. Defaults to a soft tint of the accent token. |
gradientFrom | string | No | - | Border highlight start color. Defaults to the accent token. |
gradientSize | number | No | 280 | Radius in pixels of the spotlight and border highlight. |
gradientTo | string | No | - | Border highlight end color. Defaults to the signal token. |