Description
Shadow is a library that adds Shadow DOM support to Vue, so a component can render its contents inside a shadow root. The shadow element takes a tag prop, which defaults to div, and an abstract prop that moves the shadow root and stops other external tags from being used. The current release is for Vue 3, and the README says Vue 2 projects should use version 1.x. You can use Shadow from a TypeScript or bundler project, from an import map, from a legacy global script, or from a CDN build, and the dist folder has a file for each case, including CommonJS and ES module builds for Node. The README also covers styling. Because Vue single-file components disable the style tag, a shadow-style element is provided, and it works like an HTML style tag. An experimental option uses adoptedStyleSheets. The v-shadow directive is marked deprecated.…
Highlights
- Renders Vue content inside a shadow root
- Shadow style element for component styles
- tag and abstract props
- Builds for bundlers, import maps, CDN and Node
- Experimental adoptedStyleSheets option
Ratings & Reviews
No ratings yet
Be the first to rate vue-shadow-dom.
People also visit

shadow-dom-testing-library
An extension of DOM-testing-library to provide hooks into the shadow dom
vue-shadow-dom FAQ
What is Shadow for?
It gives Vue components a Shadow DOM, so their markup and styles are kept separate from the rest of the page.
Which Vue version is it for?
The current release targets Vue 3. The README says Vue 2 projects should use version 1.x.
How do I add styles?
Use the shadow-style element, which works like an HTML style tag. The README explains that this is needed because Vue single-file components disable the style tag.
Is the v-shadow directive still recommended?
No. The README marks the v-shadow directive as deprecated.
Can I use it without a build step?
Yes. The dist folder includes a global script and browser builds for import maps and CDNs, so you can load it directly in a page.
What are the best vue-shadow-dom alternatives?
Popular alternatives to vue-shadow-dom include @webcomponents/shadycss, Vue (shadcn-vue) and @webcomponents/shadydom. See all vue-shadow-dom alternatives


















