Support for ShadowDOM

Author: freganteCreated Dec 11, 2021Updated Oct 3, 2025
Labelsenhancement

If I use a shadow DOM, the styles appended by Goober to the document’s head no longer reach it

diff
let root = document.createElement("div");
document.body.append(root);
root = root.attachShadow()
render(<Toaster />, root);

Can you expose Goober’s target? https://github.com/cristianbote/goober/blob/e3f99e960a59d606fe7d4584383834465883ec8d/docs/docs/api/targets.md#L15

For example:

diff
const root = document.createElement("div");
document.body.append(root);
root.attachShadow({mode: "closed"})
- render(<Toaster />, root);
+ render(<Toaster styleLocation={root} />, root);

Edit: Also asked in:

Source: timolins/react-hot-toast