Spotlight grid
One light source shared across every tile, so borders glow as the cursor passes.
Installation
Run the CLI
Run
pnpm dlx asta-ui@latest initonce, then this. The file lands incomponents/astabyte/and the colour tokens go into your CSS.$ pnpm dlx asta-ui@latest add spotlight-gridOr install the package
Don’t want the file? Import from
asta-ui/spotlight-gridand update withpnpm update asta-ui. Add the stylesheet once. More.$ pnpm add asta-uiimport { SpotlightGrid } from "asta-ui/spotlight-grid";Or copy it by hand
Copy this file. Keep the paths, or fix the
@/imports. Then add the tokens fromglobals.css."use client"; import { useRef } from "react"; const ITEMS = ["Brand", "Web", "Product", "Motion", "3D", "Systems", "Rust", "AI", "Docs"]; export default function SpotlightGrid() { const ref = useRef<HTMLDivElement>(null); const move = (e: React.PointerEvent) => { for (const tile of ref.current!.children as HTMLCollectionOf<HTMLElement>) { const r = tile.getBoundingClientRect(); tile.style.setProperty("--x", `${e.clientX - r.left}px`); tile.style.setProperty("--y", `${e.clientY - r.top}px`); } }; return ( <div className="flex h-full w-full items-center justify-center p-6"> <div ref={ref} onPointerMove={move} className="group grid w-full max-w-[300px] grid-cols-3 gap-1.5"> {ITEMS.map((t) => ( <div key={t} className="relative aspect-square overflow-hidden rounded-xl bg-ink p-px [background-image:radial-gradient(140px_circle_at_var(--x,-200px)_var(--y,-200px),var(--color-signal),transparent_60%)]" > <div className="flex h-full w-full items-end rounded-[11px] bg-ink p-2.5 [background-image:radial-gradient(160px_circle_at_var(--x,-200px)_var(--y,-200px),color-mix(in_srgb,var(--color-signal)_18%,transparent),transparent_60%)]"> <span className="font-mono text-[11px] uppercase tracking-[0.08em] text-paper/70">{t}</span> </div> </div> ))} </div> </div> ); }Or ask your AI agent
Paste this into Claude Code, Cursor, Codex, v0 or Lovable. Fill in the last line. More in Prompts.
Add the Astabyte UI Spotlight grid component to my project. One light source shared across every tile, so borders glow as the cursor passes. It fills its parent, so give the wrapper a size. It is designed on a dark surface: put it inside an element with the `dark` class. Install it: ```sh pnpm dlx asta-ui@latest add spotlight-grid --radix ``` Or with the shadcn CLI: ```sh pnpm dlx shadcn@latest add https://ui.astabyte.com/r/spotlight-grid.json ``` If the project isn't set up yet, run `pnpm dlx asta-ui@latest init --radix` first: it runs `shadcn init` when needed and adds the @astabyte registry (Next.js, Vite, React Router, Astro, TanStack Start; Tailwind CSS v4). Import it like this: ```tsx import SpotlightGrid from "@/components/astabyte/spotlight-grid"; ``` Usage example and props: https://ui.astabyte.com/spotlight-grid Full catalogue for context: https://ui.astabyte.com/llms.txt Rules: - Keep the colour tokens (paper, paper-2, ink, ink-2, mute, brand). Don't restyle with hard-coded colours; rebrand by changing the token values in the CSS. - Keep the motion as it is: transform and opacity only, and the prefers-reduced-motion fallback. - Keep keyboard, focus and ARIA behaviour. - Use fake data and fake brand names in examples. Use it to: [describe where it goes and what it should do]
Usage
It fills its parent. Give the wrapper a size.
import SpotlightGrid from "@/components/astabyte/spotlight-grid";
export default function Page() {
// Spotlight grid
return (
<div className="relative h-96 w-full">
<SpotlightGrid />
</div>
);
}