<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 every available attribute set on the HTML element:Attribute & prop reference
| HTML Attribute | React Prop | Type | Default | Description |
|---|---|---|---|---|
challenge-endpoint | challengeEndpoint | string | undefined | URL endpoint that returns { challenges: string[] }. If undefined, the widget cannot auto-fetch. |
verify-endpoint | verifyEndpoint | string | undefined | URL endpoint to POST the solutions. If undefined, you must handle verification manually using the solver directly. |
auto-verify | autoVerify | boolean | string | false | Starts verification automatically once the widget loads. Set to "false" or omit it to require user interaction or startVerification(). |
show-warning | showWarning | boolean | string | false | Shows a red warning banner above the widget. Often used to alert users if WebAssembly is missing for future fast-solvers. |
warning-message | warningMessage | string | "Enable WASM..." | Custom message text for the warning banner. |
solve-timeout | solveTimeout | number | string | undefined | Optional timeout in milliseconds for solving. If omitted, solving is not automatically timed out. |
disabled | disabled | boolean | string | false | Disables user interaction and programmatic verification while set. |
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[] }— legacy compatibility- raw
string[]— legacy compatibility
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:
| Method | Description |
|---|---|
startVerification() | Programmatically start the solving flow |
reset() | Reset widget to initial state |
getState() | Returns current widget state string |
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.