Command Palette

Search for a command to run...

0GitHub stars
Components

ASCII Spotlight Error

An interactive ASCII canvas spotlight error state with pointer-tracking cone beam, radial and angular luminance falloff, and reduced-motion support.

Loading…

Features

  • Pointer-tracking ASCII spotlight cone rendered on a high-DPI HTML5 canvas with damped angular interpolation.
  • Smooth radial and angular luminance falloff mapped across a configurable ASCII character ramp with optional shimmer.
  • Automatic "auto", "light", and "dark" theme synchronization with optional description, custom icon, and recovery action button.

Use cases

  • 404, 500, and fallback error boundary screens.
  • Empty or offline states that benefit from subtle interactive atmosphere.

Installation

pnpm dlx shadcn@latest add @abushaidislam/ascii-spotlight-error

Usage

import { AsciiSpotlightError } from "@/components/ascii-spotlight-error"
<AsciiSpotlightError
  message="Something went wrong"
  description="We could not load this resource. Please try again."
  actionLabel="Try again"
  onAction={() => window.location.reload()}
/>

Adjust beamLength, coneAngle, cellSize, and smoothing to tune the reach, spread, grid density, and pointer tracking speed of the spotlight.

API reference

AsciiSpotlightError

Prop

Type

Accessibility

  • Uses role="alert", aria-live="polite", and aria-labelledby linked to the primary heading while keeping the canvas and beacon aria-hidden="true".
  • Respects prefers-reduced-motion by disabling continuous requestAnimationFrame loops and shimmer, snapping cleanly to pointer updates or resting upright.

License and usage

  • Free to use and modify in both personal and commercial projects.
  • Attribution is appreciated but not required.
  • Released under the MIT License.

Was this helpful?

Command Palette

Search for a command to run...