A coffee roaster's website with a reorder form that renders inside a shadow root. The form is a small React app with PrimeReact, mounted in a container in the shadow root of a host element on the page.
The website styles every button and input on the page, and none of those rules reach the form. The form's styles do not leak out to the page either. The dark mode button in the header switches the form too.
npm install
npm run devsrc/main.tsxattaches the shadow root, adds the form's own CSS to it and rendersPrimeReactProviderwithwithShadowRoot().src/ReorderForm.tsxis the form. EachSelect.PortalhasappendTo="self", so the panels open next to the field, inside the shadow root.
Read more in Using PrimeUI components inside a shadow root.