Click Shield

Click Shield is a copy-paste React component that stops clicked button that just appeared 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/click-shield
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • No extra npm packages
  • A11y guidance in docs

StopsClicked button that just appeared

Was this component page useful?

How do I install Click Shield?

pnpm dlx shadcn@latest add @bollard/click-shield

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

How do I use Click Shield in React?

click-shield-usage.tsx
import { ClickShield, type ShieldReason } from "@/components/ui/click-shield"

<ClickShield onBlockedClick={blocked("Cancel subscription")}>
  <button
    type="button"
    onClick={() => setLog("Subscription cancelled.")}
    className={`${button} bg-destructive text-white hover:bg-destructive/90 dark:bg-destructive/60`}
  >
    Cancel subscription
  </button>
</ClickShield>

What input mistakes does Click Shield catch?

  • Clicks on a control that just mounted
  • Clicks after the control moved under the pointer (layout shift)
  • Clicks right after its label changed, or when the tab comes back
  • Enter/Space key repeats on focus that code moved there

What props does Click Shield accept?

ClickShield props
PropTypeDefault
duration

How long clicks are ignored after a change, in ms. Chrome's dialog guard uses 500.

number—
enabled

Turn the shield off entirely.

boolean—
onBlockedClick

Called for every click the shield swallowed, with the reason it was up.

(reason: ShieldReason) => void—

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

How is Click Shield accessible?

  • Keyboard presses are not delayed unless focus was moved by code
  • Exposes data-shielded for styling; no ARIA changes to the wrapped control

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

What are the limitations and server boundaries?

  • Swallows real clicks during the window too; keep duration short
  • A timing guard only: it doesn't confirm intent for destructive actions

What expensive mistakes does Click Shield stop?

Clicked button that just appeared

Also known as

layout shift · cls · misclick · click protection · late button · dialog appears · ghost click

What dependencies does Click Shield require?

None beyond React and Tailwind CSS.

Click Shield facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameClick Shield
Registry identifier@bollard/click-shield
Install commandnpx shadcn@latest add @bollard/click-shield
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)
Dependencies0 runtime dependencies
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 Click Shield

How does Click Shield protect destructive mutations?

Click Shield prevents clicked button that just appeared. Enforces deliberate friction against Clicks on a control that just mounted, Clicks after the control moved under the pointer (layout shift), Clicks right after its label changed, or when the tab comes back, Enter/Space key repeats on focus that code moved there. Limitation: authorize click-shield mutations on the server.

How do I install click-shield with shadcn?

Run `npx shadcn@latest add @bollard/click-shield`. Sources added: registry/default/click-shield/click-shield.tsx. Package requirements: zero dependencies for click-shield.

What props customize Click Shield?

Click Shield accepts `duration`, `enabled`, `onBlockedClick`. Configures layout shift, cls, misclick behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of click-shield?

Swallows real clicks during the window too; keep duration short. A timing guard only: it doesn't confirm intent for destructive actions Server requirement: backend verification for click-shield.

How does Click Shield meet accessibility guidelines?

Keyboard presses are not delayed unless focus was moved by code. Exposes data-shielded for styling; no ARIA changes to the wrapped control. Minimizes errors: button moved under cursor, layout shift click.

Which components pair with Click Shield?