---
title: "Running TinyMCE in a Shadow DOM"
description: "Running TinyMCE in a Shadow DOM"
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/shadow-dom/"
md_url: "https://www.tiny.cloud/docs/tinymce/6/shadow-dom/index.md"
version: "6"
last_updated: "2024-08-16T06:07:32Z"
tokens: 460
---
Important This page documents TinyMCE 6. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/shadow-dom/).
# Running TinyMCE in a Shadow DOM

## Running TinyMCE in a Shadow DOM

> **Important:** Running a TinyMCE instance inside a Shadow DOM is not, currently, supported.
Running a TinyMCE instance — whether in [classic mode](../use-tinymce-classic/) or [inline mode](../use-tinymce-inline/) — inside a Shadow DOM will, likely, work.

For example:

```html
<div id="shadow-host"></div>

<script type="text/javascript">

  const shadowHost = document.getElementById('shadow-host');

  // Note: Closed shadow roots are not currently, even experimentally supported.
  const shadow = shadowHost.attachShadow({mode: 'open'});

  const node = document.createElement('textarea');
  node.value = 'Text added to the <em>TinyMCE</em> editor instance <strong>on loading.</strong>';
  shadow.appendChild(node);

  tinymce.init({
    // Note: use ‘target’ to specify the node the TinyMCE editor instance replaces.
    // Do not use ‘selector’.
    target: node,
    plugins: [
        "advlist", "anchor", "autolink", "charmap", "code", "fullscreen",
        "help", "image", "insertdatetime", "link", "lists", "media",
        "preview", "searchreplace", "table", "visualblocks",
    ],
    toolbar: "undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
  });
</script>
```
But TinyMCE does not, currently, check its host node for evidence it is inside a Shadow DOM (eg, checking for the `#shadow-root` string immediately before the host node’s opening tag).

Consequently, while a TinyMCE instance will likely work as expected inside a Shadow DOM, TinyMCE instances are not, currently, supported inside Shadow DOMs.
