<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:
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:
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.