Next.js App Router
CookieChimpProvider is a server component. It reads the consent cookie, so a
returning visitor never sees the banner flash. See Next.js
for regions, the Pages Router, connected mode and strict CSP.
React
initialState so hydration matches. Read consent
in components with the hooks:
Plain JavaScript
Next steps
- Gate vendor tags with the script presets.
- Send Google Consent Mode v2 signals and block runtime-added scripts: see the reference.
- Translate the banner: translations.
Use the platform JSON for category and vendor preferences
See Banner and vendor preferences for the complete JSON contract, consent state, backend delivery, appearance controls and playground. The opt-in@cookiechimp/react/platform UI uses the same offline/config JSON
bundle as the existing widget. There is no second category or vendor list.
banners, translations, country_banner_map and
default_banner from the existing bundle. It consumes categories[].slug,
name, description, required, services[] and storage_items[]. Vendor
details keep id, name, description, company, privacy_policy_url,
accepted_by_default and storage_items, including each storage item’s name,
type, description, duration and company. Nested translations supply
localized names and descriptions. The adapter derives an internal consent_key
to map runtime service keys back to the original platform IDs. Never add that
field to the input JSON.
useConsent().services includes every configured vendor with its effective
boolean value before and after a decision. It is {} when no services are
configured. Values follow required categories, category defaults, saved vendor
choices and GPC, without saving consent or sending a log just to display them.
Set the existing preferences_gui_options.control_level to
category_and_services for per-vendor controls. category_only keeps category
controls, with vendor details when show_services is true. Category switches
update all vendors; an individual vendor updates the category when any vendor
is allowed. Changes are staged until Save; Close discards them. Required
categories and their vendors stay enabled, and GPC cannot be bypassed through
a vendor override. Button labels, visibility, colors and radii use the existing
JSON keys. Descriptions preserve safe formatting and links as React elements; executable HTML and arbitrary attributes are discarded.
Supply trusted region context from your application. The SDK performs no
location lookup. For SSR, pass the server initialState as with
ConsentProvider. The platform UI is a separate entry to preserve the default
banner bundle size.
Run the React/Vite workspace example and open /platform.html for a complete
category/vendor demo. It uses the existing redacted bundle, with the canonical
category_and_services control level, realistic Google Analytics, Microsoft
Clarity and Meta Pixel disclosures, and a separate demo cookie. It loads no
tracking tags and sends no consent records. Production logging stays explicit.
Motion
The platform stylesheet includes short entrance, disclosure and switch animations by default. No animation package or additional import is needed. The UI automatically disables motion for visitors who request reduced motion in their operating system. To disable animations for all visitors, keep the same stylesheet and passmotion={false} to the provider:
@cookiechimp/react/headless with their own stylesheet instead.
The playground includes 16 presets, an isolated actual-SDK preview, desktop/mobile
sizes, JSON export, consent state and saved-choice replay. It includes controls
for all platform layouts, positions, button placements,
button swapping, equal weight, side panels, color schemes and radii. They modify
the same JSON consumed by the SDK. See the JSON compatibility matrix
for the exact supported presentation fields and runtime integration boundaries.
The example JSON is illustrative, rather than an inventory of tags on a live site.
Google cookie details follow its GA4 documentation,
and Clarity purposes follow its cookie documentation.
Durations are example settings and may differ by site or browser. Vendor privacy
links in the JSON point to the vendors’ own policies.
This entry supplies category/vendor consent and presentation. Optional protocol
integrations, script gating and consent delivery still require their explicit
SDK integrations; reading their dashboard flags does not activate them.