# 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 %}
