Ballmac UI home

Interactive Grid

A canvas grid whose cells light up under the pointer and fade out behind it, leaving a glowing trail, drawn only while something is moving and listening on its parent so content above never blocks it.

Move your mouse

Every cell you touch glows, then fades.

Installation

$ pnpm dlx shadcn@latest add @ballmac/interactive-grid

Usage

import { InteractiveGrid } from "@/components/ballmac/interactive-grid"

The full example is in the Code tab above.

Examples

Colors and cell size

Small cells
Large cells, slow fade

API reference

PropTypeDefault
cell

Side of one cell in pixels.

number36
color

Color of the lit cells: a CSS variable name such as "--chart-1", or any CSS color.

string"--chart-1"
lineColor

Color of the grid lines.

string"--border"
radius

How many cells around the pointer light up.

number2.2
decay

Seconds a lit cell takes to fade away.

number1.4
fade

Fade the grid toward the edges.

booleantrue

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Screen readersDecorative: aria-hidden and pointer-events-none
Reduced motionA still grid; nothing lights up

Use with AI

<InteractiveGrid cell color lineColor radius decay fade /> inside a relative parent. Colors are CSS variable names. It listens to the parent, repaints on theme changes and stops its frame loop when idle. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Interactive Grid (@ballmac/interactive-grid) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Heroes and empty states that should respond to the mouse
  • Playful 404 pages

Not for

  • Touch-only audiences (there is no hover)
  • Large amounts of text over the grid

Registry JSON: https://ui.ballmac.com/r/interactive-grid.json

Credits

Free to use in personal and commercial projects.

npm
None