Hooks
useConsent()
Section titled “useConsent()”Returns the current snapshot plus actions.
| Field | Type |
|---|---|
ready |
boolean: the stored decision has been read |
needsConsent |
boolean: no valid decision, the banner is shown |
decision |
ConsentState | null |
categories, services |
effective consent per id |
mode |
"opt-in" | "opt-out" |
hasConsent(id), hasServiceConsent(id) |
|
acceptAll(), rejectAll() |
|
updateConsent(categories, { services }) |
change single categories or services |
setServiceConsent(id, granted) |
|
resetConsent() |
withdraw the decision, the banner returns |
openPreferences(), closePreferences(), preferencesOpen |
Shortcuts
Section titled “Shortcuts”useHasConsent("statistics"); // booleanuseHasServiceConsent("youtube"); // booleanuseIsAllowed({ service: "youtube" });usePermitoTranslations(); // resolved texts for custom UIs