HOC that renders component into shadow-dom
Switch branches/tags
Nothing to show
Clone or download
Latest commit c46afc7 Jul 19, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Bundled as umd Jul 18, 2016
src Initial commit Jul 18, 2016
.eslintrc Initial commit Jul 18, 2016
.gitignore Initial commit Jul 18, 2016
LICENSE Initial commit Jul 18, 2016
README.md Added readme Jul 18, 2016
package.json Bumped version Jul 18, 2016
webpack.config.js Bundled as umd Jul 18, 2016

README.md

preact-shadow-dom

Render your preact component to shadow DOM:

import ShadowDOM from "preact-shadow-dom";

var MyComponent = () => (
	<div className="my-component-class">
		<h1>My Component</h1>
	</div>
);

var ShadowMyComponent = ShadowDOM(MyComponent);

With CSS, injected into the shadow DOM root:

import ShadowDOM from "preact-shadow-dom";
import styles from "styles.css";

var MyComponent = () => (
	<div className="my-component-class">
		<h1>My Component</h1>
	</div>
);

// styles is raw css that will be injected into the shadow dom
var ShadowMyComponent = ShadowDOM(MyComponent, styles);

Related

preact-custom-element