Package Exports
- @better-captcha/react
- @better-captcha/react/base-captcha
- @better-captcha/react/package.json
- @better-captcha/react/provider
- @better-captcha/react/provider/altcha
- @better-captcha/react/provider/cap-widget
- @better-captcha/react/provider/captcha-fox
- @better-captcha/react/provider/friendly-captcha
- @better-captcha/react/provider/hcaptcha
- @better-captcha/react/provider/private-captcha
- @better-captcha/react/provider/prosopo
- @better-captcha/react/provider/recaptcha
- @better-captcha/react/provider/recaptcha-v3
- @better-captcha/react/provider/turnstile
Readme
@better-captcha/react
React wrappers for CAPTCHA providers that share the same lifecycle, render flow, and control handle so you can swap vendors without touching your UI.
[!WARNING] This library is in early development and is not production ready yet. Expect breaking API changes while the provider surface stabilises.
Installation
bun install @better-captcha/reactnpm install @better-captcha/reactBasic usage
import { ReCaptcha } from "@better-captcha/react/provider/recaptcha";
export function ContactCaptcha() {
return <ReCaptcha sitekey="your-site-key" />;
}Keep the component inside a client-only boundary, access the ref to call execute, and forward the response token to your backend alongside the form submission.
Key ideas
- Unified hook-driven lifecycle that loads provider scripts on demand.
- Shared handle API (
execute,reset,destroy,getResponse) across providers. - Provider-specific bundles such as reCAPTCHA, hCaptcha, Turnstile, and Friendly Captcha.