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:

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:

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.