Configuration
This page is the config. Flip an option, watch the live preview react, copy the generated code. Every option shows its config key — the same names you’ll find in ConsentLoopConfig and the JSON schema.
Categories
categoriesnecessary is always present and required. Add any custom categories you like — these three are just the convention.
categories.*.servicesLet visitors accept Google Analytics but reject Hotjar. Services render as an expandable list inside their category — open the preferences in the preview to see it.
Appearance
ui.layoutbox is a compact card, cloud a centered pill, bar a full-width strip.
ui.positionNine positions for box & cloud; bar snaps to a top or bottom strip. Everything is position: fixed — zero layout shift by construction.
ui.preferencesThe second layer: a centered modal or a right-side drawer. Click “Preferences” in the preview.
ui.themeauto follows prefers-color-scheme. All colors are CSS tokens you can override.
ui.tokensOverride any --cl-* token: accent, radius, spacing, border, font, shadow… Here: accent, corner radius and border.
ui.showRejectAll keeps a one-click Reject right next to Accept — no hunting through settings (keep it on under GDPR — it’s the law, and it’s the decent thing). ui.floatingButton shows a reopen bubble after consent. ui.branding toggles the small credit in the banner and preferences. ui.scrollLock freezes page scrolling while a layer is open. ui.trapFocus keeps keyboard focus inside the preferences dialog (leave on for WCAG).
Behavior
regulationgdpr: opt-in, nothing runs before consent. us-optout: category defaults apply immediately (CCPA-style), the banner offers opting out, Esc dismisses. none: opt-in UI, dismissable.
googleConsentModePushes gtag('consent', 'default', …) before Google tags load and update after every choice. See the mapping →
storageWhere consent lives (cookie is visible to your server; localStorage stays client-side), how long it’s valid, and a revision you bump to re-prompt everyone after a policy change.
Content
contentAuto-detected from <html lang>, overridable per visitor. 58 ready-made locale packs ship with the npm package (consentloop/locales/*.json) and lazy-load on demand. Any missing key falls back to built-in English. Full guide: Languages →
getConsent()