Consent Cuisine documentation
API reference
The controller methods, stable records, and subscription API.
createConsentCuisine
Creates an isolated consent controller.
const consent = createConsentCuisine({
locale: "en-GB",
cuisine: "tea",
locales: [enGB],
policyVersion: "2026-10"
});Consent actions
consent.save({ analytics: true, marketing: false });
consent.acceptAll();
consent.rejectOptional();
consent.reset();necessary categories are always enabled. A changed policyVersion invalidates the stored record.
save(selection)
Accepts a map of category IDs to booleans. Required categories are always saved as true, even when omitted from the selection.
acceptAll() and rejectOptional()
Convenience methods for the two common banner actions. acceptAll() enables every configured category. rejectOptional() keeps only the required categories enabled.
reset()
Removes the stored record and returns the controller to the unknown state.
Observe changes
const unsubscribe = consent.subscribe((record) => {
console.log(record);
});
unsubscribe();Subscriptions are useful when a banner and a preferences panel are rendered in separate parts of an application. The listener receives the new record after every save, or null after a reset.