Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Glow Card for Astro

An Astro container that paints a pointer glow on each child.

Atlas
Records the work in one place.
Harbor
Keeps the next step in view.
Nimbus
Shows the result at a glance.

Installation

bunx --bun shadcn@latest add @gnostic/glow-card

Usage

---
import {
  Card,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import { GlowCard } from "@/components/ui/glow-card"
---

<GlowCard class="flex flex-wrap gap-8 p-8">
  <Card>
    <CardHeader>
      <CardTitle>Atlas</CardTitle>
      <CardDescription>Records the work in one place.</CardDescription>
    </CardHeader>
  </Card>
</GlowCard>

GlowCard is one container. Put each Card in the default slot. Any other element works the same way. The component does not set gap, direction, or alignment. Use your own layout classes. A row, a column, and a grid all work.

The script reads each child’s position. When the pointer is within proximity of that box, the arc on that child fades in and turns toward the pointer.

class merges onto the container. colors, proximity, spread, blur, and opacity set custom properties on the container style.

The root uses data-slot="glow-card". Each child receives a decorative layer with data-slot="glow-card-glow".

Examples

Stack

The same glow follows children in a column. Give the container padding so the arc can turn on in the space around a child.

Atlas

Records the work in one place.

Harbor

Keeps the next step in view.

Custom colors

Pass CSS colors to replace the theme default. Use at least two colors.

Rose

A fixed palette stays the same in every preset.

Violet

Move the pointer along either card.

Props

GlowCardProps

PropType
colors?string[]

Colors in the shared conic glow. The first color also closes the loop. The default uses the theme foreground and primary.

Typestring[]
Default["var(--foreground)", "var(--primary)"]
proximity?number

Distance from a child edge, in pixels, that turns the glow on.

Typenumber
Default40
spread?number

Width of the bright arc, in degrees.

Typenumber
Default60
blur?number

Blur of the soft arc, in pixels.

Typenumber
Default20
opacity?number

Opacity of the glow when the pointer is outside `proximity`. `0` hides the glow until the pointer is near. `1` keeps it on.

Typenumber
Default0

Read the installed source for the complete prop types.

Slots

Slot Content
Default The elements that receive the glow.

Keyboard and behavior

The glow is decorative and is hidden from assistive technology. It follows the pointer. It does not move for keyboard focus.

prefers-reduced-motion: reduce skips pointer tracking and keeps the resting opacity.

Theme and layout

Give each child a background, a radius, and padding. The arc uses that radius. The soft arc can paint outside the child. A direct Card child gets overflow-visible from the container, so the card recipe does not clip that blur.

The child’s own ::before and ::after stay available. The glow uses a layer inside the child.