# Look and feel

## Languages

Our SDK supports multiple languages out-of-the-box with translations for all our standard messages. See below if your website uses other languages.\
English is the default language: if a visitor does not use a supported language, the banner and popups will be displayed in English.

You do not need to do anything to use Didomi's languages. However, you can choose to enable only certain languages and set up a different default language.\
Set the `languages.enabled` property to your list of supported languages and `languages.default` property as the default language in case the customer language is not supported:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  languages: {
    enabled: ['en', 'es', 'fr'], // List of languages that visitors can use (must be a subset of the languages that we support)
    default: 'fr' // Default language to use if the visitor uses a language that is not enabled
  }
};
</script>
```

By default, `enabled` is the list of supported languages by Didomi and `default` is `en`. You can support different languages by changing the English texts and setting English as the only enabled language.

{% hint style="info" %}
We currently support [this list of languages](https://developers.didomi.io/api-and-platform/introduction/translations#languages-supported).
{% endhint %}

### **Language direction**

The Didomi SDK adapts to the text direction of your website by default, inheriting the `dir` attribute from its parent elements, typically the `<html>` or `<body>` tag. This ensures compatibility with the overall layout of your site.

To understand more about the HTML `dir` attribute please refer to <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir>

#### **Overriding language direction**

If you need the Didomi notice to have a different text direction from the rest of your website, you can override it with custom CSS.

The Didomi notice is rendered in a `div` element with ID `didomi-host` that contains:

* a `lang` attribute to identify the language on the notice
* a `data-lang-dir` attribute with the suggested direction to use for the language applied

Example of HTML generated by the Didomi SDK for a notice in Arabic:

```html
<div id="didomi-host" lang="ar" data-lang-dir="rtl">...</div>
```

With these attributes you can apply CSS rules like:

```css
/* Target a single language */
#didomi-host[lang="ar"] {
  direction: rtl;
}

/* Target all languages that are suggested as RTL */
#didomi-host[data-lang-dir="rtl"] {
  direction: rtl;
}
```

## Theme

The SDK supports theming by providing a color that will be used across the interfaces (consent notice, popups, etc.) to make sure that our UIs match your brand colors.

The color that you provide should be the main color of your website, the one that appears most frequently.

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  theme: {
    color: '#3F51B5'
  }
};
</script>
```

## Position

The notice can be displayed as a popup, a regular banner (top or bottom), a smaller banner or as a floating panel and can be positioned at different locations on the screen.

The `position` configuration parameter lets you define the position of the notice. The possible values are:

| Values                                                                                                                                  | Description                                                                                                             |
| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `popup`                                                                                                                                 | Display the notice as a full-screen popup. Also set your website logo and name to make sure the popup is personnalized. |
| <p><code>panel-top-left</code><br><code>panel-top-right</code><br><code>panel-bottom-left</code><br><code>panel-bottom-right</code></p> | Display the notice as a small panel in one of the corners of the screen. `panel-bottom-right` is the default value.     |
| <p><code>top</code><br><code>bottom</code></p>                                                                                          | Display a banner notice at the top or the bottom of the screen                                                          |
| <p><code>top-left</code><br><code>top-right</code><br><code>bottom-left</code><br><code>bottom-right</code></p>                         | Display a floating panel in a corner of the screen                                                                      |

Examples:

{% tabs %}
{% tab title="Banner" %}

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  notice: {
    position: 'bottom'
  }
};
</script>
```

{% endtab %}

{% tab title="Corner banner" %}

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  notice: {
    position: 'panel-bottom-right'
  }
};
</script>
```

{% endtab %}

{% tab title="Popup" %}

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  notice: {
    position: 'popup'
  }
};
</script>
```

{% endtab %}

{% tab title="Floating panel" %}

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  notice: {
    position: 'top-left'
  }
};
</script>
```

{% endtab %}
{% endtabs %}

## **"Disagree and close" button**

By default, our notices display `Agree and close` and `Learn More` buttons. These allow users to give consent or get more information on the purposes and vendors that your website works with.

We also support displaying `Agree and close` and `Disagree and close` buttons directly in the notice:

![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-67bf4c26ddfa94cdab5158dbdaf04cba85aeb47c%2Foptin-notice.png?alt=media)

To display those buttons, set the `notice.denyOptions.button` of your notice to `primary`

```javascript
window.didomiConfig = {
  notice: {
    denyOptions: {
      button: 'primary',
    }
  }
};
```

This is supported for both banners (`bottom` or `top` positions) or pop-ins (`popup` position).

### Style of the "Disagree and close" button

In the example above the `Disagree and close` button is a primary button. To make it a secondary button, you can set the `notice.denyOptions.button` configuration option `secondary`:

```javascript
window.didomiConfig = {
  notice: {
    denyOptions: {
      button: 'secondary',
    }
  }
};
```

To hide the `Disagree and close` button in the notice you can set `notice.denyOptions.button` to `none`.

{% hint style="danger" %}
Please note that the `denyAsPrimary` parameter is deprecated and should not be used for the styling of the "Disagree and close" button.
{% endhint %}

### "Continue without agreeing" link

A "Continue without agreeing" link can be displayed instead of the "Disagree and close" button in the `optin` notice type:

![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-4b895c4de6d6dd27561f227f0d74039335370976%2Fpopup-notice-continue-without-agreeing.png?alt=media)

To show the "Continue without agreeing" link, set the `notice.denyOptions.link` value to `true`:

```javascript
window.didomiConfig = {
  notice: {
    denyOptions: {
      button: 'secondary',
      link: true,
    }
  }
};
```

The "Continue without agreeing" link behaves the same way as the "Disagree and close" button.

Please note that if `notice.denyOptions.link` is `true` then `notice.denyOptions.button` options will be ignored and only a link will be shown in the notice.

{% hint style="danger" %}
Please note that the `denyAsLink` parameter is deprecated and should not be used for the "Continue without agreeing" link configuration.
{% endhint %}

### **Cross button**

To comply with Italian regulation, you should add a cross button to the notice. To make the cross button appear in the notice set the `notice.denyOptions.cross` parameter value to `true`:

```javascript
window.didomiConfig = {
  notice: {
    denyOptions: {
     cross: true,
     link: true,
    }
  }
};
```

![Italian Regulation example](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-8d962c7a4fee0779e02898a29d246a263670d623%2FScreenshot%202022-01-17%20at%2016.52.33.png?alt=media)

Please note that you can have both the “Disagree and close button” and the cross button in the same notice, for example:

```javascript
window.didomiConfig = {
  notice: {
    denyOptions: {
     button: 'primary',
     link: true,
    }
  }
};
```

![Italian Regulation Example](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-6bdfc3a8ade088e60ca3603fef7cb8db8aa04e91%2FScreenshot%202022-01-17%20at%2016.54.48.png?alt=media)

### Configuring legitimate interest legal basis status

After clicking on the "Disagree and close" button or "Continue without agreeing" link in the optin notice, all purposes' and vendors' consents are disabled, and all purposes' and vendors' legitimate interests are enabled by default.

To disable legitimate interests as well after clicking on the "Disagree and close" button or "Continue without agreeing" link, `notice.denyAppliesToLI` should be set to `true` in the Didomi configuration object:

```javascript
window.didomiConfig = {
  notice: {
    type: 'optin',
    denyAppliesToLI: true
  }
};
```

## Close button

For notices with position `popup`, you can show a Close icon to allow users to ignore the notice until the next page:

![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-89eeb6aa15e92583d1ad79e1528cb7becbb27ac8%2FScreen%20Shot%202020-03-02%20at%2010.16.26%20PM.png?alt=media)

To show the Close icon, set the `notice.canCloseAndIgnore` value to `true`:

```javascript
window.didomiConfig = {
  notice: {
    canCloseAndIgnore: true,
    position: 'popup',
    type: 'optin'
  }
};
```

## Text alignment

You can change the alignment of the text inside the notice. The options are `left`, `right`, `center` and `justify`. By default, the text is aligned to the `left`.

Example:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  notice: {
    textAlignment: 'left'
  }
};
</script>
```

## Logo alignment

You can change the alignment of the logo inside the notice. The options are the one available for the CSS property [align-self](https://www.w3schools.com/cssref/css3_pr_align-self.asp). So for example to align it to the left, the value would be `flex-start` and to the right `flex-end`. By default, the logo is aligned to the `center`.

Example:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  notice: {
    logoAlignment: 'center'
  }
};
</script>
```

## Buttons

### Order

You can change the order of the buttons inside the notice. By default `learnMorePosition` is `null` and the "learn more" button is displayed before the "agree" button on the regular notice and after on the popup notice.

The options are `before` and `after`.

Example:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  notice: {
    learnMorePosition: null
  }
};
</script>
```

### Margins

You can set the margins of the "learn more" button on the popup notice.

The options are based on the CSS `margin` property.

Example:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  notice: {
    learnMoreMargin: '20px 0 5px 0'
  }
};
</script>
```

## Texts

You can change some of the texts of the consent notice:

| Configuration Key             | Description                                                                                                                            |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `notice.content.dismiss`      | "Agree & Close" button                                                                                                                 |
| `notice.content.deny`         | "Decline" button                                                                                                                       |
| `notice.content.learnMore`    | "Learn More" button                                                                                                                    |
| `notice.content.subTextPopup` | Message below the "Learn more" button in the popup. This is only used if you are using a popup and not for banners or floating panels. |

Example:

```javascript
<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>'
  },
  notice: {
    content: {
      dismiss: {
        en: 'Agree & Close',
        fr: 'Accepter et fermer'
      },
      learnMore: {
        en: 'Learn More',
        fr: 'En savoir plus'
      }
    }
  }
};
</script>
```

Note that you should provide translations for all the languages that your website supports. We provide translations for all our standard messages.

#### Move the vendors link in your banner to your custom text

If you want to move the vendor link to your custom text `notice.content.notice` instead of having a separate link, you can use the function `Didomi.preferences.show('vendors')` to open the preference popup. The original link will be automatically replaced.

```markup
<a href="javascript:Didomi.preferences.show('vendors')">View partners</a>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.didomi.io/cmp/web-sdk/consent-notice/notice/look-and-feel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
