[{"data":1,"prerenderedAt":134},["ShallowReactive",2],{"navigation":3,"\u002Fblog\u002Fmoving-embedded-configurators-to-shadow-dom":14,"\u002Fblog\u002Fmoving-embedded-configurators-to-shadow-dom-surround":133},[4],{"title":5,"path":6,"stem":7,"children":8,"page":13},"Blog","\u002Fblog","blog",[9],{"title":10,"path":11,"stem":12},"Why We Moved Our Embedded Configurators to Shadow DOM","\u002Fblog\u002Fmoving-embedded-configurators-to-shadow-dom","blog\u002Fmoving-embedded-configurators-to-shadow-dom",false,{"id":15,"title":10,"author":16,"body":20,"date":124,"description":125,"extension":126,"image":127,"meta":128,"minRead":129,"navigation":130,"path":11,"seo":131,"stem":12,"__hash__":132},"blog\u002Fblog\u002Fmoving-embedded-configurators-to-shadow-dom.md",{"name":17,"avatar":18},"Haji Mohammed",{"src":19,"alt":17},"\u002Fhero\u002Favatar.jpg",{"type":21,"value":22,"toc":117},"minimark",[23,27,32,44,47,51,59,72,75,107,111,114],[24,25,26],"p",{},"At Onfigr, a lot of what we build doesn't live on our own website. Our product configurators are embedded directly into flooring and interiors brands' sites, where customers use them to explore products and visualise them in a room. That's great for our customers, but it means our UI has to survive in an environment we don't control.",[28,29,31],"h2",{"id":30},"the-problem-with-just-a-custom-element","The problem with \"just a custom element\"",[24,33,34,35,39,40,43],{},"Our original embeds were custom elements, but they rendered into the light DOM. Everything inside them was exposed to the host page's CSS, so a client's global ",[36,37,38],"code",{},"button"," styles, a reset stylesheet or an aggressive ",[36,41,42],{},"* { box-sizing }"," rule could quietly break the layout. The reverse could happen too: our styles occasionally leaked out and affected the page around us.",[24,45,46],{},"Each new client integration came with a round of CSS firefighting, which slowed down onboarding and produced bugs that were hard to reproduce on our side.",[28,48,50],{"id":49},"moving-to-shadow-dom","Moving to Shadow DOM",[24,52,53,54,58],{},"The fix was to move to standards-based Web Components that render into a ",[55,56,57],"strong",{},"Shadow DOM",". With a shadow root, the configurator's markup and styles are encapsulated:",[60,61,62,66,69],"ul",{},[63,64,65],"li",{},"Host page styles no longer cascade into the configurator.",[63,67,68],{},"Our styles stay scoped to the component and never leak out.",[63,70,71],{},"The embed behaves the same way on every client site.",[24,73,74],{},"A few things needed care along the way:",[60,76,77,87,97],{},[63,78,79,82,83,86],{},[55,80,81],{},"Styling hooks."," Clients still want to match their brand, so we exposed deliberate customisation points (CSS custom properties and ",[36,84,85],{},"::part",") instead of relying on the cascade.",[63,88,89,92,93,96],{},[55,90,91],{},"Fonts and global assets."," ",[36,94,95],{},"@font-face"," rules don't work the same way inside a shadow root, so font loading needed rethinking.",[63,98,99,102,103,106],{},[55,100,101],{},"Third-party libraries"," that assume ",[36,104,105],{},"document","-level queries or global styles sometimes needed adapting.",[28,108,110],{"id":109},"the-result","The result",[24,112,113],{},"Encapsulating the configurators removed a whole category of integration bugs and made onboarding new clients noticeably smoother. It also paired well with the component library we were building at the same time, since components could be developed and tested once and behave predictably wherever they were embedded.",[24,115,116],{},"If you're shipping UI that runs on other people's websites, I'd strongly recommend starting with Shadow DOM rather than retrofitting it later.",{"title":118,"searchDepth":119,"depth":119,"links":120},"",2,[121,122,123],{"id":30,"depth":119,"text":31},{"id":49,"depth":119,"text":50},{"id":109,"depth":119,"text":110},"2026-10-17","What I learned leading the switch from legacy custom elements to standards-based Web Components, and why style encapsulation matters when your product lives on someone else's website.","md",null,{},4,true,{"title":10,"description":125},"4MqHHaqNxmr1-oQjJD6J2Rsa0WLL4l0l5yZgoMoYrIA",[127,127],1792275872613]