# Enable or disable an extension

## Registering an extension

**Both themes and extensions can register extensions**. In order to do it, the extension should be added to `mosaic.extensions` object of `package.json` . The extension must be a valid NPM package, therefore you are required to add it into `dependencies` field of your `package.json`.&#x20;

Enabling and disabling an extension is achieved by setting the `true`or `false` as a value of the extension's key in `mosaic.extensions` .&#x20;

Your theme can also control enabled extensions across the whole application. This allows to disable the previously enabled extension. The sequence of preference in this case is:

1. Your theme's enabled extensions
2. Your theme's parent themes' enabled extensions
3. Extensions' enabled extensions

{% code title="./package.json" %}

```javascript
{
    "dependencies": {
        "@example/enabled-package": "0.0.1",
        "@example/disabled-package": "file:./packages/@example/disabled-package"
    }
    "mosaic": {
        "extensions": {
            "@example/enabled-package": true,
            "@example/disabled-package": false
        }
    }
}
```

{% endcode %}

{% hint style="danger" %}

### Watch out!

Disabling a previously enabled extension can lead to layout-shifts and issues inside of your parent theme. Also, there might be extensions plugging into the extension you intend to disable, this can lead to unexpected results.
{% endhint %}


---

# 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://docs.mosaic.js.org/install-an-extension/enable-or-disable-an-extension.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.
