Fill Before Copy

Fill Before Copy is a copy-paste React component that stops pasted a command with your_api_key in it before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/fill-before-copy
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPasted a command with YOUR_API_KEY in it

Was this component page useful?

How do I install Fill Before Copy?

pnpm dlx shadcn@latest add @bollard/fill-before-copy

The files land in your project. They're yours to edit.

How do I use Fill Before Copy in React?

fill-before-copy-usage.tsx
import { FillBeforeCopy } from "@/components/ui/fill-before-copy"

<FillBeforeCopy code={code} defaultValue={{ project_id: "prj_8f3k2" }} />

What input mistakes does Fill Before Copy catch?

  • Placeholders left in a command or config snippet
  • Which placeholder is still empty, by moving focus to it
  • Custom placeholder syntaxes via `pattern`

What props does Fill Before Copy accept?

FillBeforeCopy props
PropTypeDefault
code* (required)

The snippet, with placeholders like `<YOUR_API_KEY>` or `{{project_id}}`.

string—
title

Header text, e.g. "Terminal" or "bash".

string"Terminal"
pattern

Which placeholder syntax to detect.

RegExpPLACEHOLDER
value

Controlled values by placeholder name.

Record<string, string>—
defaultValue

Initial values when uncontrolled.

Record<string, string>{}
onValueChange

Called with every value on each change.

(value: Record<string, string>) => void—
unfilled

"block" refuses to copy until every placeholder is filled; "warn" asks once, then copies.

"block" | "warn""block"
onCopy

Called with the filled text that went to the clipboard.

(text: string) => void—
fillLabel

Templates: `{count}` and `{names}` are filled in.

string"Fill {count}"
leftText

Status text counting placeholders left ({count} is filled in).

string"Still a placeholder: {names}."
readyText

Status text when every placeholder is filled.

string"All placeholders filled."
copyLabel

Copy button text.

string"Copy"
copiedLabel

Shown after copying.

string"Copied"
copyAnywayLabel

Text for copying with placeholders left.

string"Copy anyway"
blockedText

Shown when Copy is blocked.

string"Couldn't copy. Your browser blocked clipboard access."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Fill Before Copy accessible?

  • Each placeholder field has an aria-label from its name, with aria-invalid when asked to fill it
  • Copy is described by an aria-live="polite" status; blocked copy moves focus to the first empty field
  • Errors use role="alert"

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Only finds placeholders matching the pattern
  • Values typed into the fields are in the page; avoid pre-filling real secrets in shared docs

What expensive mistakes does Fill Before Copy stop?

Pasted a command with YOUR_API_KEY in it

Also known as

code snippet · copy button · placeholder · docs · curl · api key · template · copy to clipboard

What dependencies does Fill Before Copy require?

Fill Before Copy facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameFill Before Copy
Registry identifier@bollard/fill-before-copy
Install commandnpx shadcn@latest add @bollard/fill-before-copy
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Fill Before Copy

What form validation mistake does Fill Before Copy catch?

Fill Before Copy prevents pasted a command with YOUR_API_KEY in it. Turns placeholders like <YOUR_API_KEY> in a code sample into fields and holds Copy until they're filled, so broken commands aren't pasted. Catches: Placeholders left in a command or config snippet, Which placeholder is still empty, by moving focus to it, Custom placeholder syntaxes via `pattern`. Limitation: validate fill-before-copy schemas on backend.

How do I install fill-before-copy with shadcn?

Run `npx shadcn@latest add @bollard/fill-before-copy`. Sources added: registry/default/fill-before-copy/fill-before-copy.tsx. Package requirements: lucide-react.

What props customize Fill Before Copy?

Fill Before Copy accepts `code`, `title`, `pattern`, `value`, `defaultValue`. Configures code snippet, copy button, placeholder behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of fill-before-copy?

Only finds placeholders matching the pattern. Values typed into the fields are in the page; avoid pre-filling real secrets in shared docs Server requirement: backend verification for fill-before-copy.

How does Fill Before Copy meet accessibility guidelines?

Each placeholder field has an aria-label from its name, with aria-invalid when asked to fill it. Copy is described by an aria-live="polite" status; blocked copy moves focus to the first empty field. Errors use role="alert". Minimizes errors: copied placeholder api key, curl command with placeholder.

Which components pair with Fill Before Copy?