Hairline Coords

Hairline Coords is a full-bleed container that draws thin crosshair lines and a ring that follow the pointer, with live X/Y coordinate readouts. When the pointer enters a link or button, the lines briefly tear and glitch.

Hairline Coords
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @glint-ui/hairline-coords

Requires @glint-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { HairlineCoords } from "@/components/ui/hairline-coords"<HairlineCoords className="h-[400px]">  <a href="#">Home</a></HairlineCoords>
  • Hero or landing sections that need a precise, technical HUD-style hover effect across the whole area
  • Showcase or portfolio areas where a crosshair cursor and live coordinates add a sense of measurement or interface
  • Navigation or CTA-heavy sections where a glitch flash on link and button hover gives feedback
  • Dark-themed marketing pages that want a subtle, decorative cursor treatment without custom canvas code

Examples

Hero with glitching CTA

A green crosshair over a hero section. Hovering the button triggers the glitch and expands the ring.

hero-with-glitching-cta.tsx
import { HairlineCoords } from "@/components/ui/hairline-coords"export function HeroExample() {  return (    <HairlineCoords color="#00ff88" className="h-[480px] bg-black">      <div className="flex h-full items-center justify-center">        <button type="button" className="rounded border border-white/20 px-6 py-3 text-white">          Get started        </button>      </div>    </HairlineCoords>  )}

Subtle decorative divider section

Coordinates and glitch are turned off, leaving only thin, faint lines with the native cursor kept visible.

subtle-decorative-divider-section.tsx
import { HairlineCoords } from "@/components/ui/hairline-coords"export function SubtleExample() {  return (    <HairlineCoords      showCoords={false}      glitch={false}      hideCursor={false}      thickness={0.5}      className="h-72 bg-neutral-950"    >      <p className="p-8 text-neutral-400">Measured, quiet, precise.</p>    </HairlineCoords>  )}

Custom glitch targets

Only elements marked with a data attribute trigger the glitch, instead of the default links and buttons.

custom-glitch-targets.tsx
import { HairlineCoords } from "@/components/ui/hairline-coords"export function CustomTargetExample() {  return (    <HairlineCoords targetSelector="[data-glitch]" className="h-96 bg-zinc-900">      <div className="grid grid-cols-3 gap-4 p-8">        <div data-glitch className="rounded bg-zinc-800 p-4 text-white">Card A</div>        <div className="rounded bg-zinc-800 p-4 text-white">Card B</div>        <div data-glitch className="rounded bg-zinc-800 p-4 text-white">Card C</div>      </div>    </HairlineCoords>  )}

API reference

PropTypeDefaultDescription
childrenReactNode—Content rendered beneath the crosshair overlay.
colorstring"#ffffff"Stroke, ring, and label color for the lines and readouts.
thicknessnumber1Line width in px.
showCoordsbooleantrueShows the live X and Y readouts next to the lines.
glitchbooleantrueBriefly distorts the lines when the pointer enters a target. Disabled when the user prefers reduced motion.
targetSelectorstring"a, button"CSS selector for elements that trigger the glitch and ring expansion. Matched with closest() inside the container.
hideCursorbooleantrueHides the native cursor inside the container via a global style rule scoped to the data attribute.
classNamestring—Additional classes applied to the root container, which is relative and overflow-hidden.

Accessibility

  • The SVG overlay has aria-hidden and pointer-events disabled, so the crosshair and coordinate readouts are decorative and are not announced by screen readers.
  • Children remain in the normal document flow and stay fully interactive, focusable, and readable by assistive technology.
  • The glitch effect is skipped when the user has prefers-reduced-motion: reduce set. The ring and line movement still update.
  • hideCursor removes the native pointer inside the container. Set hideCursor={false} where users need a visible cursor, for example on forms or text-heavy content.
  • The effect is pointer-driven. Keyboard focus does not move the crosshair or trigger the glitch, so do not rely on it to convey state.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Hairline Coords" component (glint-ui/hairline-coords) from its shadcn registry.1. Install it with: npx shadcn@latest add @glint-ui/hairline-coords2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: children, color, thickness, showCoords, glitch, targetSelector, hideCursor, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { HairlineCoords } from "@/components/ui/hairline-coords"<HairlineCoords className="h-[400px]">  <a href="#">Home</a></HairlineCoords>```

Files & dependencies

  • registry/ui/hairline-coords.tsx
registryDependenciesutils

Looks similar, elsewhere