Glin UI
Primitive / MoleculeAdapted from Magic UIbeta

Magic Card

Card whose border and surface light up under the pointer or keyboard focus.

Edit on GitHub
ProBilled monthly

$24/ seat

  • Unlimited projects
  • Priority support
  • Audit log export

Installation

Install from
pnpm dlx @glinui/cli@latest add magic-card

Credits. 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 more

plain

Crisp on any stage.

Learn more

solid

Crisp on any stage.

Learn more

glass

Opt-in. Needs a backdrop.

Learn more
import { 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 more

success

The effect color follows the tone token.

Learn more

warning

The effect color follows the tone token.

Learn more

danger

The effect color follows the tone token.

Learn more

info

The effect color follows the tone token.

Learn more
import { 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.

StarterBilled monthly

$0/ seat

  • Unlimited projects
  • Priority support
  • Audit log export
ProBilled monthly

$24/ seat

  • Unlimited projects
  • Priority support
  • Audit log export
TeamBilled monthly

$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 transitions

API Reference

PropTypeRequiredDefaultDescription
variantSurfaceVariant | "default"-ambient (glinr)Base surface from the Card vocabulary. Glass is opt-in.
autoPlaybooleanNofalseLoops a slow synthetic pointer (demos, screenshots, touch). Needs motion level full.
gradientSizenumberNo280Radius in pixels of the spotlight and the border highlight.
gradientColorstringNoaccent tintSpotlight fill color.
gradientFromstringNovar(--color-accent)Border highlight start color.
gradientTostringNovar(--color-signal-ok)Border highlight end color.
...CardPropsCardProps--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/motion

Generated API Snapshot

Beta

Auto-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

PropTypeRequiredDefaultDescription
autoPlaybooleanNofalseRuns 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.
gradientColorstringNo-Spotlight fill. Defaults to a soft tint of the accent token.
gradientFromstringNo-Border highlight start color. Defaults to the accent token.
gradientSizenumberNo280Radius in pixels of the spotlight and border highlight.
gradientTostringNo-Border highlight end color. Defaults to the signal token.