Ballmac UI home

Glare Hover

Wraps any content so a diagonal band of light sweeps across it on hover or keyboard focus, in white for images and dark surfaces or a soft shadow for light ones.

Installation

$ pnpm dlx shadcn@latest add @ballmac/glare-hover

Usage

import { GlareHover } from "@/components/ballmac/glare-hover"

The full example is in the Code tab above.

Examples

Light and dark tone

Light glare

For images and dark surfaces.

Dark glare

A soft shadow band for light cards.

API reference

PropTypeDefault
angle

Tilt of the band of light, in degrees.

number18
duration

Milliseconds the sweep takes.

number800
intensity

Brightness of the glare, from 0 to 1.

number0.55
tone

"light" sweeps white light, good over images and dark surfaces. "dark" sweeps a soft shadow, good on light surfaces.

"light" | "dark""light"

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
FocusThe sweep also plays when something inside gains keyboard focus
Screen readersThe glare is aria-hidden
Reduced motionNo glare is drawn

Use with AI

<GlareHover angle duration intensity tone='light|dark'>anything</GlareHover>. The sweep runs once per hover and resets instantly when the pointer leaves. Pure CSS transitions; nothing renders on pointer move. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Glare Hover (@ballmac/glare-hover) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Product images, posters and cards
  • Anything that deserves a small touch of polish on hover

Not for

  • Pointer-following lighting (magic-card or spotlight-card)

Registry JSON: https://ui.ballmac.com/r/glare-hover.json

Credits

Free to use in personal and commercial projects.

npm
None