Widget Reference
The Squeaker widget is a web component (<squeaker-widget>) that works in any HTML page or JavaScript framework.
Basic embed
<squeaker-widget data-sitekey="sq_live_your_key" data-api="https://api.squeaker.cc/v1" data-theme="light" data-mode="interactive" ></squeaker-widget> <script src="https://cdn.squeaker.cc/squeaker.js" async defer></script>
Attributes
| Attribute | Required | Description |
|---|---|---|
data-sitekey | Yes | Public site key from the dashboard (starts with sq_live_). |
data-api | No | API base URL. Default: https://api.squeaker.cc/v1. |
data-theme | No | Visual theme. Default: light. |
data-border | No | Show widget frame. Default: true. Set false for borderless. |
data-mode | No | Display and trigger mode. Default: interactive. |
data-form | No | CSS selector for the form to attach to (recommended for auto mode). |
data-callback | No | Name of a global JavaScript function called on successful verification. |
data-lang | No | Language code or auto. Omit for auto-detection. |
Themes
| Theme | Best for |
|---|---|
light | Default. Clean white card, mint accent. |
dark | Near-black card for dark pages and night mode — blends with #0a0a0a / #111 backgrounds. |
cheese | Flat golden cheese — readable on light and dark page backgrounds. |
terminal | Retro CRT terminal — phosphor green on near-black, monospace, subtle scanlines and glow. |
sunset | Warm orange gradient background. |
mono | Monospace font, sharp corners - developer tools aesthetic. |
Modes
interactive (default)
User clicks the widget to verify. Best for high-value actions where you want visible confirmation (signup, payment).
invisible
Widget is hidden. Verification runs automatically on page load. Best for low-friction pages where you still want protection before any interaction.
<squeaker-widget data-sitekey="sq_live_xxx" data-mode="invisible" ></squeaker-widget>
auto
Widget shows (unless combined with invisible styling). On form submit, solves the challenge and injects a hidden squeaker-token input. Blocks submit until verified.
<form id="signup" data-squeaker-auto>
<squeaker-widget
data-sitekey="sq_live_xxx"
data-mode="auto"
data-form="#signup"
></squeaker-widget>
<button type="submit">Sign up</button>
</form> Languages (30)
Supported codes: en, zh, es, ar, pt, id, fr, ja, ru, de, ko, tr, it, nl, pl, vi, th, uk, cs, ro, hu, el, sv, hi, bn, ms, fil, da, fi, no.
Auto-detection
By default the widget reads navigator.languages, region code, and timezone to pick the best match. Unsupported locales fall back to English.
- Omit
data-langor setdata-lang="auto"for detection. - Set
data-lang="hu"to force a specific language. - Arabic (
ar) enables RTL layout automatically.
JavaScript API
Methods
const widget = document.querySelector('squeaker-widget');
await widget.execute(); // run verification, returns token string
widget.getToken(); // current token or null
widget.reset(); // clear token and reset UI Events
| Event | Detail |
|---|---|
squeaker-success | { token: string } |
squeaker-error | { message: string } |
squeaker-reset | Widget was reset |
squeaker-state | { state: 'idle' | 'solving' | 'solved' | 'error' } — UI state changes |
widget.addEventListener('squeaker-success', (e) => {
console.log('Token:', e.detail.token);
// submit form or call your API
}); Callback attribute
<script>
function onVerified(token) {
console.log(token);
}
</script>
<squeaker-widget
data-sitekey="sq_live_xxx"
data-callback="onVerified"
></squeaker-widget> Framework examples
Plain HTML / WordPress
Paste the script tag before </body> and add the widget inside your form template.
React / Next.js
Use the <squeaker-widget> web component in your JSX and load squeaker.js once (e.g. in useEffect). See Server Verify for a full example — no npm package required.
Vue / Svelte / Angular
Use the web component directly in your template. Load squeaker.js once in your app shell or layout.
Bundle size
~32 KB single IIFE file. No external dependencies. Proof-of-work runs in a Web Worker so the main thread stays responsive.
Troubleshooting
- Widget not appearing: Check that
squeaker.jsloaded (Network tab). CORS must allow your page origin on the API. - Challenge fails: Confirm
data-sitekeymatches a site in the dashboard and your domain is whitelisted. - Wrong language: Set
data-langexplicitly or check browser locale settings.