JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q81363F
  • License MIT

Lit wrappers for CAPTCHA providers that share the same lifecycle, render flow, and control handle so you can swap vendors easily.

Package Exports

  • @better-captcha/lit
  • @better-captcha/lit/base-captcha
  • @better-captcha/lit/package.json
  • @better-captcha/lit/provider
  • @better-captcha/lit/provider/altcha
  • @better-captcha/lit/provider/cap-widget
  • @better-captcha/lit/provider/captcha-fox
  • @better-captcha/lit/provider/friendly-captcha
  • @better-captcha/lit/provider/hcaptcha
  • @better-captcha/lit/provider/private-captcha
  • @better-captcha/lit/provider/prosopo
  • @better-captcha/lit/provider/recaptcha
  • @better-captcha/lit/provider/recaptcha-v3
  • @better-captcha/lit/provider/turnstile

Readme

@better-captcha/lit

Lit web components 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/lit
npm install @better-captcha/lit

Basic usage

import { ReCaptcha } from "@better-captcha/lit/provider/recaptcha";

// The component is automatically registered as a custom element named "recaptcha-captcha"
const captcha = document.querySelector('recaptcha-captcha');
const handle = captcha.getHandle();
<recaptcha-captcha sitekey="your-site-key"></recaptcha-captcha>

Each provider has its own element name:

  • Turnstile: <turnstile-captcha>
  • hCaptcha: <hcaptcha-captcha>
  • reCAPTCHA: <recaptcha-captcha>
  • Friendly Captcha: <friendly-captcha>
  • Private Captcha: <private-captcha-widget>
  • Captcha Fox: <captcha-fox-captcha>
  • Prosopo: <prosopo-captcha>

Access the handle to call execute, and forward the response token to your backend alongside the form submission.

Key ideas

  • Unified 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.
  • Built with Lit for modern, standards-based web components.