Custom elements

Learn how to use Assembler CSS with custom elements

You can use the framework with custom elements as well. All you have to do is to register the element’s shadow root with Assembler CSS.

At the moment this feature works only with browsers that have support for adopted stylesheets.

class MyCustomElement extends HTMLElement {
    constructor() {
        super();
        const shadowRoot = this.attachShadow({mode: 'open'});
        AssemblerCSS.handleShadowRoot(shadowRoot);
        
        // ...
    }
}