<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
Yourchallenge-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:{ challenges: string[] }— recommended contract{ tokens: string[] }— compatibility support- raw
string[]— compatibility support
Adaptive difficulty (calibration)
For adaptive workloads, setchallenge-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.
Verification request body
When you provide averify-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 defaultwasm-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-modecontrols whether solving runs in a Web Worker or on the main thread.wasm-modecontrols which solver backend runs inside a healthy worker.
wasm-mode="disabled" to force the JavaScript solver, for example when debugging or when a strict Content Security Policy blocks WebAssembly:
wasmMode prop:
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 setdisabled (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-verifyfrom starting - Removes the widget from the tab order
- Sets
aria-disabled="true"for accessibility
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.
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:
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 usingRibauntWidgetHandle:
React-only props
In addition to the attributes above, the React wrapper accepts typed callback props and aref. These have no HTML attribute equivalent and are handled entirely inside the React wrapper:
onVerify— fired when verification succeedsonError— fired when an error occursonStateChange— fired when the widget transitions between statesonReady— fired once after the widget mountsonLoad— alias foronReady, provided for backward compatibilityonEvent— catch-all handler for all event typesref— imperative handle exposingreset(),getState(), andstartVerification()
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.