Getting Started
Components
Search for a command to run...
import { HighlightGridHover } from "@/registry/tween/highlight-grid-hover"
export function HighlightGridHoverDemo() {
return <HighlightGridHover />
}
import { HighlightGridHover } from "@/components/ui/highlight-grid-hover"<HighlightGridHover
rows={[
["Design", "Build", "Ship"],
["React", "Next.js", "Three.js", "GSAP"],
]}
colors={["#E24E1B", "#4381C1", "#04A777"]}
/>Each inner array of rows becomes a row of cells. A single absolutely-positioned highlight block reads the hovered cell's bounding box on every pointermove (resolved with elementFromPoint) and transitions its transform, width, height, and background color to match — so it appears to glide and morph between cells while the labels stay readable above it. On narrow containers the rows stack vertically (via container queries) and the highlight is hidden, leaving a clean stacked list. When prefers-reduced-motion: reduce is set the CSS transition is disabled so the highlight snaps instantly.
| Prop | Type | Default | Description |
|---|---|---|---|
rows | React.ReactNode[][] | 2 defaults | Each inner array is one row of cell labels. |
colors | string[] | 8 defaults | Highlight colors, cycled across the flattened cells. |
background | string | "#1a1a1a" | Outer background color. |
foreground | string | "#ffffff" | Label text color. |
borderColor | string | translucent | Color of the grid lines. |
className | string | — | Extra classes on the outer container. |