Account

Chrome

Creative

Spotlight Border

A border that answers the pointer. Pair it with usePointer on any surface; SpotlightCard is built from it.

Install

Included with Creative: needs your API key. Initialize and log in once.

Terminal
npx @galactrex/ui add spotlight-border

Usage

Example
import { SpotlightBorder } from "@/components/galactrex/spotlight-border";

const p = usePointer();

<div {...p.handlers} className="relative rounded-xl border border-gxui-line p-6">
  <SpotlightBorder x={p.x} y={p.y} active={p.active} />
  Settings
</div>

Source

Installs to components/galactrex/spotlight-border.tsx, with the shared motion primitives beside it.

Source for this component comes with its plan. Install it with the command above, or open your licensed copy here.

See plans

Props

PropTypeDefaultDescription
x, yMotionValue<number>—Pointer position in px, from usePointer() on the parent.
activeboolean—Whether the pointer is over the parent.
sizenumber180Radius of the lit area in px.
widthnumber1Border width in px.
colorstringvar(--gxui-glow)Light colour.
classNamestring—Extra classes for the outer element.

Variants

  • On any surface. Spread `usePointer().handlers` on the parent and pass its x, y and active.

Accessibility

  • Decorative only and aria-hidden.
  • Off on touch: there is no hover to follow.

Motion and reduced motion

  • The light moves through motion values, with no React re-render per pointer move.
  • Fades in and out over 250 ms.