Skip to main content
Clever Ops

String Pluck Field

A playable field of hairline strings for React, they bend around the pointer and ring with damped harmonic decay when plucked by cursor, tap, or keyboard. Tailwind token strokes.

Preview & code

Loading String Pluck Field preview

Installation

pnpm dlx shadcn@latest add @cleverui/string-pluck-field

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

Usage

tsx
import { StringPluckField } from '@/components/ui/string-pluck-field'
Exampletsx
import { StringPluckField } from '@/components/ui/string-pluck-field'

export default function StringPluckFieldDemo() {
  return (
    <div className="mx-auto w-full max-w-2xl 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 · press, release, ring
      </p>
      <h2 className="mb-6 text-2xl font-semibold tracking-tight text-balance sm:text-3xl">
        Seven wires under your hand.
      </h2>
      <StringPluckField lines={7} decay={1.4} ariaLabel="Plucked string field" />
      <p className="mt-4 text-sm leading-relaxed text-muted-foreground">
        Drift across a string to press it; leave quickly to pluck. On a keyboard,
        Up/Down select a line and Enter rings it at the midpoint.
      </p>
    </div>
  )
}

API reference

StringPluckField accepts the following props.

PropTypeDefaultDescription
linesnumber7string count (clamped 4–10)
decaynumber1.4seconds for a pluck to ring out (clamped 0.5–3)
ariaLabelstring'Plucked string field'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 String Pluck Field component?

Register the @cleverui registry in your components.json ("@cleverui": "https://cleverops.com.au/r/{name}.json"), then run `npx shadcn@latest add @cleverui/string-pluck-field`. 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 String Pluck Field require?

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

Can I theme String Pluck Field 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