Skip to main content
Clever Ops

Slingshot Plotter

A slingshot ballistics range for React, drag to aim with a live predicted arc, fire, and every shot etches its trajectory with plotted coordinates. Keyboard aimable, Tailwind tokens.

Preview & code

Loading Slingshot Plotter preview

Installation

pnpm dlx shadcn@latest add @cleverui/slingshot-plotter

Requires the @cleverui registry in your components.json, a one-off, two-line setup.

Usage

tsx
import { SlingshotPlotter } from '@/components/ui/slingshot-plotter'
Exampletsx
import { SlingshotPlotter } from '@/components/ui/slingshot-plotter'

export default function SlingshotPlotterDemo() {
  return (
    <div className="mx-auto w-full max-w-3xl px-4 py-10 sm:px-6 sm:py-14">
      <p className="mb-4 font-mono text-[11px] uppercase tracking-[0.2em] text-muted-foreground sm:text-xs">
        Spectacle · drag to aim · enter to fire
      </p>
      <h2 className="mb-6 text-2xl font-semibold tracking-tight text-balance sm:text-3xl">
        Chart the shot before it lands.
      </h2>
      <SlingshotPlotter
        power={1}
        ghostShots={5}
        caption="BALLISTICS RANGE 04"
        ariaLabel="Slingshot trajectory toy"
      />
      <p className="mt-4 text-sm leading-relaxed text-muted-foreground">
        Pull the node back to load the band. The dotted arc is the same integrator
        that flies the shot, arrows nudge aim, Enter fires.
      </p>
    </div>
  )
}

API reference

SlingshotPlotter accepts the following props.

PropTypeDefaultDescription
powernumber1launch velocity multiplier (clamped 0.5–1.5)
ghostShotsnumber5previous trajectories kept as fading etches (clamped 0–8)
captionstring'BALLISTICS RANGE 04'mono micro-label on the stage frame
ariaLabelstring'Slingshot trajectory toy'accessible name for the stage

…plus everything from React.HTMLAttributes<HTMLDivElement>: className, event handlers, aria attributes and the rest pass straight through.

Frequently asked questions

How do I install the Slingshot Plotter component?

Register the @cleverui registry in your components.json ("@cleverui": "https://cleverops.com.au/r/{name}.json"), then run `npx shadcn@latest add @cleverui/slingshot-plotter`. The shadcn CLI copies the source into your project, you own the code from that point. You can also copy the source directly from this page.

What dependencies does Slingshot Plotter require?

Slingshot Plotter has no npm dependencies beyond React and Tailwind CSS itself, so there is nothing extra to install or keep updated.

Can I theme Slingshot Plotter to match my brand?

Yes. The component is styled entirely with Tailwind utilities over standard design tokens (primary, background, muted, border), so it inherits your existing shadcn/ui theme automatically. Change your CSS variables and the component follows, no source edits needed for palette, radius, or fonts.

Want this built for you?

CleverUI is built by the Clever Ops web team. If you'd rather ship a hand-coded, fast, custom website than assemble one, we build them for Australian businesses every week.

Explore web development services