> For the complete documentation index, see [llms.txt](https://developers.didomi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.didomi.io/api-and-platform/widgets/privacy-widgets/edit-a-widget/content-and-design/components/preference.md).

# preference

`LayoutComponent` ❌ Theme ✅ Options ✅ Content & Translations

### Overview <a href="#overview" id="overview"></a>

The `preference` component displays a preference and its associated values within a widget. When the parent purpose has [one-click consent](/api-and-platform/data-manager/configuration-tree.md#consent-propagation) enabled, this component's values are automatically updated when users toggle the purpose.

#### Behavior with one-click consent <a href="#behavior-with-one-click-consent" id="behavior-with-one-click-consent"></a>

When a preference belongs to a purpose with one-click consent enabled:

* **Multi-choice preferences**: Values are automatically selected/deselected when the parent purpose is toggled
* **Mono-selection preferences**: Not affected by one-click consent, users must make explicit selections
* **User overrides**: If a user manually changes a preference value, that explicit choice is preserved even when propagation occurs

### Editing preference component <a href="#editing-preferences" id="editing-preferences"></a>

To edit a Preference, you need to edit the layout-component `preference` and send a **PATCH** request on `/widgets/layout-component/{layout-component-id}` and specify the following options in the `options` property.

| Element       | Description                                                                                                           | Component options                                                                                                            |
| ------------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `title`       | Name of the preference. If not empty for a language, it overrides root content created in Preferences library.        | [DidomiTextOptions](/api-and-platform/widgets/privacy-widgets/edit-a-widget/content-and-design/options.md#didomitextoptions) |
| `description` | Description of the preference. If not empty for a language, it overrides root content created in Preferences library. | [DidomiTextOptions](/api-and-platform/widgets/privacy-widgets/edit-a-widget/content-and-design/options.md#didomitextoptions) |

```json
PATCH https://api.didomi.io/widgets/layout-components/{layout_component_id}?organization_id=YOUR_ORG_ID&widget_id=YOUR_WIDGET_ID

{
    "type": "footer",
    "organization_id": "String",
    "options": {
        "title": {
            "content": {
                "en": "ADD_YOUR_PREFERENCE_TITLE",
                "fr": "TITRE_DE_PREFERENCE"
            }
        },
        "description": {
            "content": {
                "en": "ADD_YOUR_PREFERENCE_DESCRIPTION",
                "fr": "DESC_PREFERENCE"
            }
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.didomi.io/api-and-platform/widgets/privacy-widgets/edit-a-widget/content-and-design/components/preference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
