Skip to Content
🎉 Coral x Panda has been released 🎉 Read the Migration Guide

CookieSelection

CookieSelection is a sub-component of the CookiePreferences organism.

Basic Usage

import { CookiePreferences, CookieSelection } from '@krakentech/coral-organisms'; const cookies = [ { disabled: true, isCheckedByDefault: true, label: 'Essential', id: 'essential', tooltip: "These ones are required, and without them turned on, welp, our site just wouldn't work!", }, { disabled: false, isCheckedByDefault: false, label: 'Analytics & customisation', id: 'analytics', tooltip: 'These ones help us understand how customers are using our site. They help us build better features and tailor our content for different people.', }, { disabled: false, isCheckedByDefault: false, label: 'Marketing & social media', id: 'marketing', tooltip: 'These ones help us reach you on social media or other websites to help you with queries or present relevant offers.', }, ]; <CookiePreferences initialDisplayMode="selection"> ... <CookieSelection onAcceptEverything={() => console.log('Accepted all cookies')} cookies={cookies} /> </CookiePreferences>

Full API

NameTypeDefault
saveButtonLabelstring
hasGranularCookiesboolean

Should we allow the user to choose granular cookies?

false;
granularButtonLabelstring
onPreferencesChosen(cookiesChosen: Record<string, boolean>) => void

A callback for when the user chooses options on the CookieSelection view

cookiesCookies

An array of configuration to generate the checkboxes on the CookieSelection view

Last updated on