# consent Cookie consent banner (GDPR): 4 categories (necessary / functional / analytics / marketing), stored in a versioned cookie, Google Consent Mode, content from the CookieSettings global. A settings window in three modes to pick from (`settings`: in the bar, small window, large window with cookie details). Default look in plain Tailwind, overridable. ## Dependency The banner uses an icon from `lucide-react` — a regular `dependencies` entry of the package (`^0.400.0`), installed together with IAPL; you add nothing in the project. ## Config The **CookieSettings** global — **Cookies** in the admin (slug `cookie-settings`, group *Privacy*) — is always built. Tabs: *Banner*, *Settings window*, *Categories*, *Cookie list*; with the cookie scanner also *Review and approve* and *Site check* (one entry for everything about cookies — see [cookie-scanner.md → Admin layout](./cookie-scanner.md#admin-layout)). Public read (`read: () => true` — the banner reads it for anonymous visitors); `update` is limited to the `admin` and `editor` roles (`adminOrEditor` — consent texts are legal copy, not for plain `user` accounts). To change it: `iapl({ globalOverrides: { 'cookie-settings': { access: { update } } } })`. The only plugin option in this module is `consentLog` (below). The editor manages the banner content (message, buttons, categories, settingsTitle) in the panel, localized. The privacy policy link comes from system pages (`privacyPolicy`), not from a separate field. **Privacy policy link in the banner (since 1.7.12)** — zero code: | What | Where from | |---|---| | Where it leads | Site settings → System pages → Privacy Policy | | Link text | Cookies → `privacyLinkLabel` (per language) | | When the text is empty | title of the policy page in that language | `privacyPolicy` options in `getConsentTexts`: omit (automatic), `false` (no link), `{ page }` (your own page, read with `locale: 'all'`). The `label` parameter is **deprecated** — text hard-coded in code breaks A0 with several languages; it works only when the panel field is empty. Remove it from projects when you update them. ## Front — Provider + banner Usually one line in the layout (PROGRAMISTA §2.8) — `SiteProviders` (`/rsc`) wires the provider, banner, button and `Analytics` in the right order, with texts from `getSiteShell(locale).consent`: ```tsx }>{children} ``` `SiteProviders` also takes `cookieMap`, `banner={false}`, `cookieButton={false}` (or your own element), `gpc` (Global Privacy Control, below), `maxAgeDays` (re-ask period), `logEndpoint` (default: the shell's consent log endpoint; `false` = not posted) and `analytics={false | { consentMode, defer, deferTimeoutMs }}` (`consentMode: 'basic'` = no Google request before consent — see [analytics.md](./analytics.md)). By hand (your own layout) — the same from the individual parts: The provider wraps the app; the banner and the button render themselves. Import from `@intecion/ipal-kit/client`: ```tsx // app/(frontend)/[locale]/layout.tsx import { ConsentProvider, CookieBanner, CookieButton } from '@intecion/ipal-kit/client' import { getConsentTexts } from '@intecion/ipal-kit' export default async function Layout({ children, params }) { const { locale } = await params const payload = await getPayload({ config }) // texts from Cookie banner; the policy link is automatic: // target = System pages → Privacy Policy, text = Cookies → privacyLinkLabel const texts = await getConsentTexts({ payload, config: i18nConfig, locale }) return ( {children} ) } ``` `ConsentProvider` — props: `texts` (required, `ConsentTexts` from `getConsentTexts`), `cookieMap` (extra cookies to delete on withdrawal), `logEndpoint` (consent log — pass `"/api/ipal/consent"` when you wire the provider by hand; `SiteProviders` does it itself), `gpc` (`'honour'` default, `'ask'`, `false` — [Global Privacy Control](#global-privacy-control-1170)), `maxAgeDays` (days a choice is kept, default 180), `nonce` (CSP nonce for the banner's first-paint script), `cookieValue` (optional server-read cookie — [First paint](#first-paint-the-banner-is-part-of-the-first-render-1170)). `CookieBanner` does not render after a decision, `CookieButton` — the opposite (it shows only after a decision and reopens the banner). Since 1.17.0 the banner is in the server HTML and painted with the page, not after hydration (next section). Built-in banner texts follow the page language: `consentFallback(locale)` → `CONSENT_FALLBACK_PL` on `pl`, `CONSENT_FALLBACK` (English) otherwise; panel values always win. Category names for your own selects: `CONSENT_CATEGORY_LABELS` (`{ en, pl }` per category), `consentCategoryOptions()`. `` takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecion/ipal-kit/rsc`). `getConsentTexts({ payload, config, locale, privacyPolicy?, settingsSlug? })` — `settingsSlug` is the SiteSettings slug for the automatic link (default `'site-settings'`). Empty fields in the panel → English fallback. | `CookieBanner` prop | Default | Description | |---|---|---| | `classNames` | — | slots (table below) — a given one replaces the default | | `equalChoice` | `true` (since 1.17.0) | "Reject" styled like "Accept all"; `false` = the secondary look (before 1.17.0; iapl-doctor warns) | | `firstPaint` | `true` | banner in the server HTML, decided before the first paint; `false` = nothing until the page has hydrated (as before 1.17.0) | | `nonce` | provider's | CSP nonce for the first-paint script; default: the one given to `ConsentProvider` / `SiteProviders` | | `icon` | `true` | cookie icon | | `order` | `['settings', 'reject', 'accept']` | banner buttons; keep `'reject'` (a development warning and iapl-doctor say so when it is missing) | | `settings` | `'inline'` | `'inline' \| 'modal' \| 'detailed'` | | `controls` | `'checkbox'` | `'checkbox' \| 'switch'` | | `settingsActions` | `['back', 'save']` | buttons under the categories (`'accept' \| 'back' \| 'reject' \| 'save'`) | ### Where the cookie button sits (1.17.2) `CookieButton` is fixed in the **bottom corner of the window** — on every page, long or short, at every scroll position, on desktop and phone — and it **never moves**. It is a child of `` (never inside the footer) and it no longer climbs above the footer when the footer scrolls into view (1.12.x–1.17.1 did that: on a phone with a tall footer the button ended at the top of the screen, on a short page in the middle of it). **Room under the footer.** A fixed button would, at the very end of a page, lie on whatever is in that corner — the first link of the footer's last row — and a visitor could not scroll it free. So while the button is shown, the plugin gives the page's last block (the footer) **bottom padding: just enough for its last row to end above the button** (`reserveCookieButtonSpace`). The footer's background continues through it. | | | |---|---| | How much | measured, not fixed: the button's height + its distance from the bottom + the device's safe area + 8 px, **minus what is already free** under the lowest text or control in the button's column. The footer's own bottom padding counts first — never double space. On the reference site: 42–43 px on phones and desktop | | Where nothing is in the corner | nothing is added (a centred footer on a wide screen, the button on the other side) — so there is no breakpoint to configure | | When | only while the button is shown: not before a decision, not while the banner is open (the footer is as the project made it), gone when the button is turned off (`cookieButton={false}`) | | No layout shift | on a static page the HTML carries a small inline script next to the button's place: for a visitor who already decided it makes the room **before the first paint** (in a style sheet, so React hydrates the server's markup untouched), and the button's own measurement after hydration gives the same size. After a click in the banner the room appears with the button. Later changes (fonts, a form that grows, a resize) are followed | | Which block | the last element matching `reserve` (default `COOKIE_BUTTON_RESERVE` = `'footer, [role="contentinfo"]'`); none on the page → `` | | Prop | Default | What it does | |---|---|---| | `side` | `'left'` | corner: `'left'` or `'right'` | | `reserve` | `COOKIE_BUTTON_RESERVE` | CSS selector of the block that gets the room (the last match); `false` = no room — the button then covers what is in the corner at the end of the page | | `avoid` | — | placement before 1.17.2: a CSS selector the button lifts above while it is on screen — `avoid={COOKIE_BUTTON_AVOID}` (`'footer, [role="contentinfo"]'`) is exactly the old default (`bottomOverlap`); no room is reserved then. `false` = the default (kept for sites that set it) | | `className` | — | replaces the default classes; position is then yours too (room is measured from the real button once it is on the page, and only while it is `position: fixed`) | **Set the amount yourself:** `--ipal-cookie-button-space` on the footer — any length, added to the footer's own padding instead of the measured amount; `0` = none, also per breakpoint: ```css footer { --ipal-cookie-button-space: 4rem; } @media (min-width: 64rem) { footer { --ipal-cookie-button-space: 0; } } /* nothing on desktop */ ``` Position tokens: `--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset` (from the side, default `1rem`); the device's safe-area insets (bottom and the chosen side) are added. z-index `--ipal-z-header` (default 40): above the page, below the banner, the settings window and the lightbox (50). Hidden while the banner is showing. Keyboard: a `