Substantive.Blazor.Captcha 9.4.0-build20260114r2

Blazor.Captcha

Blazor.Captcha is a .NET 10 Blazor component library for integrating CAPTCHA widgets (Google reCAPTCHA v2/v3 and hCaptcha) into Blazor WebAssembly and Server applications. It provides reusable components, JSInterop adapters, and flexible configuration for secure user validation.

Features

  • Google reCAPTCHA v2: Interactive challenge widget.
  • Google reCAPTCHA v3: Background risk scoring and badge.
  • hCaptcha: Privacy-focused CAPTCHA alternative.
  • Blazor-idiomatic API: Use as Razor components with event callbacks.
  • Culture, theme, and position customization.
  • AOT compatible and supports .NET 10.
  • JSInterop adapters for script management and event handling.
  • Extensive logging via ILogger.

Installation

  1. Add the NuGet package to your project:
dotnet add package Blazor.Captcha
  1. Register required services in your Program.cs:
builder.Services.AddBlazorCaptcha();

Usage

Google reCAPTCHA v2

@using Substantive.Blazor.Captcha

<ReCaptchaV2 SiteKey="your-site-key"
             OnSuccess="HandleSuccess"
             OnExpired="HandleExpired" />

Google reCAPTCHA v3

@using Substantive.Blazor.Captcha

<ReCaptchaV3 SiteKey="your-site-key"
             Position="ReCaptchaV3Position.BottomRight"
             OnSuccess="HandleSuccess" />

hCaptcha

@using Substantive.Blazor.Captcha

<HCaptcha SiteKey="your-hcaptcha-site-key"
          Size="HCaptchaSize.Normal"
          OnSuccess="HandleSuccess"
          OnExpired="HandleExpired" />

Event Callbacks

  • OnSuccess: Invoked with the CAPTCHA token when completed.
  • OnExpired: Invoked when the challenge expires.

Resetting Captcha

Each component exposes a ResetCaptcha() method to allow users to retry the challenge.

Configuration

  • Culture: Set via the Culture parameter (e.g., "en", "fr").
  • Theme: Automatically detects dark/light theme for reCAPTCHA v3.
  • Position: For reCAPTCHA v3 badge (BottomRight, BottomLeft, Inline).
  • Size: For hCaptcha (Normal, Compact, Invisible).

Advanced

  • JSInterop adapters (ReCaptchaV2JS, ReCaptchaV3JS, HCaptchaJS) can be injected for direct control.
  • Logging extensions for diagnostics.
  • Custom JSON converter for widget IDs.

License

Copyright © United Nations.
MIT License.

Contributing

Contributions and issues are welcome via the repository.

Showing the top 20 packages that depend on Substantive.Blazor.Captcha.

Packages Downloads
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
5
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
6
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
7
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor essential building blocks. It packed standalone Blazor components and extensions that often use such as Navigation, Exception Handling, Localization, etc,.
7

.NET 10.0

Version Downloads Last updated
9.4.0-build20260115R1 5 01/15/2026
9.4.0-build20260114R5 2 01/14/2026
9.4.0-build20260114R4 2 01/14/2026
9.4.0-build20260114R3 2 01/14/2026
9.4.0-build20260114R2 2 01/14/2026
9.4.0-build20260114R1 2 01/14/2026
9.4.0-build20260113R2 3 01/13/2026
9.4.0-build20260109R1 3 01/09/2026
9.4.0-build20251226R1 3 12/26/2025
9.3.3-build20251226R1 1 12/26/2025
9.3.2-build20251225R1 3 12/25/2025
9.3.0-build20251223R1 2 12/23/2025
9.2.0-build20251222R2 3 12/22/2025
9.2.0-build20251222R1 2 12/22/2025
9.1.0-build20251218R1 2 12/18/2025
9.1.0-build20251217R1 3 12/17/2025
9.1.0-build20251215R1 4 12/15/2025
9.1.0-build20251212R1 2 12/12/2025
9.1.0-build20251211R1 3 12/11/2025
9.1.0-build20251207R1 3 12/07/2025
9.1.0-build20251203R1 1 12/03/2025
9.1.0-build20251202R1 1 12/02/2025
9.1.0-build20251201R1 1 12/01/2025
9.1.0-build20251128R3 2 11/28/2025
9.1.0-build20251128R2 2 11/28/2025
9.1.0-build20251128R1 1 11/28/2025
9.0.4-build20251127R1 10 11/27/2025
9.0.4-build20251125R1 4 11/25/2025
9.0.4-build20251124R6 3 11/24/2025
9.0.4-build20251124R4 3 11/24/2025
9.0.4-build20250909R1 1 09/09/2025