Skip to content

Cookie declaration

renderCookieList paints a categorised inventory of the cookies your site uses into any element — ideal for a standalone cookie-policy or privacy page.

<div id="cookie-declaration"></div>
<script>
lightning("renderCookieList", "#cookie-declaration");
</script>
renderCookieList(
target: string | HTMLElement,
options?: CookieListOptions
): Promise<void>;
  • target — a CSS selector or element to render into.
  • The inventory is grouped by category, each cookie showing its name, provider, retention and description.
  • Requires a configured backend (apiBase + siteId) — the inventory is served from your site’s scan results.

Unlike the banner and modal, renderCookieList does not use a shadow root and adds no CSS of its own. It renders plain semantic HTML — a heading and paragraph per category, then a dl of dt/dd pairs per cookie — directly into target, so it inherits your page’s fonts, colors, and heading styles and reads as part of the page. The class names it adds (lightning-cmp-cookie-list__category, __desc, __cookies, __empty) are unstyled hooks you can target from your own site CSS if you want to.

Option Default Meaning
text your init() copy Override category labels/descriptions.
showDescriptions true Show each cookie’s description.
hideEmpty false Hide categories with no cookies.
heading "h3" Heading element (h1h6) for each category title.