Skip to main content
The <ribaunt-widget> Web Component and its React wrapper share the same configuration surface. HTML uses kebab-case attributes; React uses camelCase props. You can use both interchangeably depending on your stack — everything described here applies to both unless noted otherwise.

Quick example

The snippet below shows the most commonly used attributes on the HTML element:

Attribute & prop reference

Challenge endpoint response format

Your challenge-endpoint should return a JSON body containing the challenge tokens that the widget will solve. The recommended response shape is { challenges: string[] }.
The widget accepts three response formats from challenge-endpoint:
  1. { challenges: string[] } — recommended contract
  2. { tokens: string[] } — compatibility support
  3. raw string[] — compatibility support
Invalid or mixed-type token arrays will fail fast with a clear widget error event.

Adaptive difficulty (calibration)

For adaptive workloads, set challenge-method="POST" and calibrate="true". The widget then benchmarks the browser and sends the result as { calibration } in the POST body. Your challenge endpoint forwards the calibration to createChallenge({ difficulty: 'auto', calibration }), letting the server pick a difficulty and amount that fit the user’s device — while never lowering the server-owned baseline.
See createChallenge for the server-side options.

Verification request body

When you provide a verify-endpoint, the widget sends a JSON payload shaped like this:

WASM solver

The widget ships with a WebAssembly-backed SHA-256 batch solver that hashes in larger batches than the JavaScript solver, increasing solve throughput. With the default wasm-mode="preferred", the solver worker attempts to load the bundled .wasm binary and uses it when it initializes successfully. If WebAssembly is disabled, the asset fails to load, or instantiation fails, the worker falls back to the JavaScript solver automatically. Solutions are identical either way, so no server-side changes are needed. wasm-mode and worker-mode are independent:
  • worker-mode controls whether solving runs in a Web Worker or on the main thread.
  • wasm-mode controls which solver backend runs inside a healthy worker.
Set wasm-mode="disabled" to force the JavaScript solver, for example when debugging or when a strict Content Security Policy blocks WebAssembly:
In React, pass the matching wasmMode prop:
To observe which backend the worker selected, listen for the solver-backend event. The event detail reports wasm, js, or argon2id and never includes challenge contents.
wasm-mode only controls the SHA-256 solver. When your server issues Argon2id challenges, the widget detects the algorithm from the tokens, loads the Argon2id solver automatically, and reports argon2id as the backend. No widget configuration is needed to support Argon2id.
Strict CSP deployments may need wasm-unsafe-eval in script-src for WebAssembly compilation, plus access to the .wasm asset. The binary is loaded relative to the module URL, which Vite, Next.js, and native ESM resolve automatically. If your CSP blocks it, the widget still works through the JavaScript fallback.

Disabled state behavior

When you set disabled (or any value other than "false"), the widget enters a fully inert state. Specifically, it:
  • Blocks click interaction
  • Blocks keyboard activation
  • Makes startVerification() a no-op
  • Prevents auto-verify from starting
  • Removes the widget from the tab order
  • Sets aria-disabled="true" for accessibility
Use disabled to prevent users from re-submitting while your server processes a form, then clear it once the response arrives. Here is a React example that toggles the disabled prop based on a loading flag:

Secondary loader (hide the percentage)

By default, the widget shows a conic progress ring with a live percentage (for example, Solving... 42%). Set show-progress="false" to switch to a quieter loader: a 12-bar pulse spinner inside the checkbox with a static Loading... label during fetching, solving, and verifying. Use this mode when you want a calmer UI, or when a moving percentage is a distraction next to the rest of your form. The default loader is unchanged, so this is fully opt-in and backwards compatible.
In React, pass the matching showProgress prop. The wrapper forwards false (or "false") through to the element verbatim, so the bars loader works the same from React. Omit the prop entirely to keep the default progress ring:
The spinner bars are drawn with currentColor, so they inherit the same color as the Loading... label across light and dark themes. Progress is still tracked internally and reported in state-change and verify event details, so telemetry and analytics keep working without changes.

Imperative methods (via ref)

You can call methods directly on the widget element to control it programmatically. In React, obtain a typed ref using RibauntWidgetHandle:

React-only props

In addition to the attributes above, the React wrapper accepts typed callback props and a ref. These have no HTML attribute equivalent and are handled entirely inside the React wrapper:
  • onVerify — fired when verification succeeds
  • onError — fired when an error occurs
  • onStateChange — fired when the widget transitions between states
  • onReady — fired once after the widget mounts
  • onLoad — alias for onReady, provided for backward compatibility
  • onEvent — catch-all handler for all event types
  • ref — imperative handle exposing reset(), getState(), and startVerification()
See the Events reference for full detail on each callback, their payload types, and usage examples.
Browser solving requires HTTPS or http://localhost. Loading from a plain LAN URL (e.g., http://192.168.x.x) will fail because the Web Crypto API is unavailable.