<st-cookie-consent>
JSON type: CookieConsent
Fixed bottom consent bar with explicit choices: accept all, reject all optional cookies, or (with
categories and a settings-button-text) open a settings panel to allow categories one by one.
Optional categories are off until the visitor turns them on. The choice is kept in localStorage
(storage-key, default sankhya_ui_cookie_consent; storage errors are ignored) and the bar renders
nothing once a choice exists. Fires cookie-consent-accept, cookie-consent-refuse or
cookie-consent-save (detail { status, categories }). The default slot replaces the message
text. privacy-policy-link opens in the same tab for a site path, in a new tab for an external URL.
While a modal is open (<html data-st-modal-open>, set by st-quote-dialog) the bar is hidden
(visibility: hidden) and inert, and it reappears unchanged when the modal closes. While the mobile
nav drawer is open (<html data-st-drawer-open>, set by st-header) the bar is not displayed.
While the bar is shown its height is published as --st-cookie-banner-height on <html> (removed
when it is dismissed), so a page's footer can pad its last row above the bar.
Usage
import '@sankhyatronics/sankhya-cms/cookie-consent'; // registers <st-cookie-consent>
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
message | message | string | '' | |
acceptButtonText | accept-button-text | string | 'Accept' | |
refuseButtonText | refuse-button-text | string | 'Reject' | |
settingsButtonText | settings-button-text | string | 'Settings' | Label of the button that opens the settings panel. Shown only with categories. |
saveButtonText | save-button-text | string | 'Save choices' | |
settingsHeading | settings-heading | string | 'Cookie settings' | |
categories | — | CookieCategory[] | [] | Cookie groups for the settings panel. Without any, the bar only offers accept and reject. |
privacyPolicyLink | privacy-policy-link | string | '' | |
privacyPolicyText | privacy-policy-text | string | 'Privacy Policy' | |
storageKey | storage-key | string | 'sankhya_ui_cookie_consent' |
Events
| Event | Detail | Description |
|---|---|---|
name | CustomEvent | |
cookie-consent-accept | Every category allowed. | |
cookie-consent-refuse | Only required categories allowed. | |
cookie-consent-save | The categories picked in the settings panel. |
See the live examples in Storybook.