Implementation guide

Prevent duplicate form submissions in React

Add a reusable React submit guard that disables repeat sends while a request is pending and gives people a clear retry path.

The mistake this stops

The same form or payment is sent twice while the first request is still pending.

One deliberate submission, a visible pending state, and a form that remains recoverable if the request fails.

Read the Safe Submit component docs for its live preview, API, accessibility notes, dependencies, and limitations.

Install the component

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/safe-submit.json

Use it safely

  1. Install the component into your shadcn project.
  2. Pass the async save or payment handler you already use.
  3. Keep idempotency and authorization checks on the server; the UI prevents accidental repeats, not malicious requests.