Checkboxes

Introduction

Name: didomi-checkboxes Component type: checkboxes Extends: DidomiBlock

Display a group of checkboxes.

window.didomiConfig = {
...
entities: [...],
components: {
layout: {...},
activeComponents: [
{
id: "ID_OF_THE_COMPONENT",
type: "checkboxes",
options: {
...,
propKey: "PROP_VALUE" // Remember to use camelCase for the key
}
}
]
}
};

Inline configuration

<didomi-checkboxes container-id="CONTAINER_ID" prop-key="PROP_VALUE" .../>

Setup

For this component to work properly, you will need to have entities (purposes, preferences and channels) available to link to the checkboxes.

A checkboxes element is linked to an entity and its parents, if any. The children of the current entity will be displayed in the checkboxes (name, status). If you want to display channels, your current entity is the preference (parent of the channels you want to display). You will have to populate the purposeId and the preferenceId.

window.didomiConfig = {
...
entities: [
{
id: "purpose-id",
name: "...",
description: "..."
},
{
id: "preference-id",
name: "Preference 1"
},
{
id: "email",
name: "Email"
},
{
id: "sms",
name: "SMS"
}
],
containers: [
{
purposes: [
{
id: "purpose-id",
preferences: [
{
id: "preference-id",
channels: [
{
id: "email",
},
{
id: "sms",
}
]
}
]
}
]
}
],
components: {
activeComponents: [
{
id: "ID_OF_THE_COMPONENT",
type: "checkboxes",
options: {
...,
purposeId: "purpose-id",
preferenceId: "preference-id"
}
}
]
}
};

If you want to display a list of channels created at root level in the tree of the entities, the only attribute necessary is childrenType which will have to be set to channels.

Props Options

Name

Type

Description

childrenType

String

Type of the children you want to display (purposes, preferences, channels)

color

String

Color of the checkbox

display

String

CSS display property. Example: 'flex', 'inline' ...

enabledPath

String

If you want to save the consent status in a different path in the metadata object of the current entity, you can set a different path as a string. For example if you want to save the consent in a brands object located in the entity metadata, for the brand didomi, in an attribut called enabled, you would add brands.didomi.enabled

exclude

Array

List of entities IDs you want to exclude from the list

isShown

Boolean

display/hide the element (default true)

items

DidomiCheckbox

Sent as an option object to the didomi-checkbox

preferenceId

String

ID of the preference linked to the checkbox.

purposeId

String

ID of the purpose linked to the checkbox.

saveOnClick

Boolean

Should the consent be saved on click or set as pending consent. This attribute gives you the choice to either save the consent immediately or wait and save all the pending consents together with a didomi-save component for example. Default value: false.

For inline configuration, make sure to use kebab-case syntax. For example purposeId will become purpose-id.

Examples

If you want to see the image, please click on the Open preview in new window button to see the example on full screen.

Object configuration

window.didomiConfig = {
...
entities: [...],
components: {
layout: {...},
activeComponents: [
{
id: "checkboxes-preferences",
type: "checkboxes",
options: {
purposeId: "purpose-id",
preferenceId: "preference-id",
color: "#003790",
items: {
activeLabel: {
style: {
default: {
background: "rgba(0,0,0,0.1)"
}
}
}
}
}
}
]
}
};