-
I really love the @mantine/core package. I have built the entire side project and now have to load that in an iframe. How to get the hosted CSS or where in DOM is the stylesheet for mantine packages? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 29 replies
-
Mantine does not use JSS anymore, please update to the latest version and see if that resolves your issue. |
Beta Was this translation helpful? Give feedback.
-
My case is not an iframe, but the shadow-dom, but I think is the same. //creates the shadow dom
const element = document.createElement('div');
const shadowRoot = element.attachShadow({ mode: 'open' });
const mountPoint = document.createElement('div');
const emotionRoot = document.createElement('div');
shadowRoot.appendChild(mountPoint);
shadowRoot.appendChild(emotionRoot);
document.body.appendChild(element);
ReactDOM.render(
<MantineProvider
defaultProps={{ Portal: { target: emotionRoot } }} // this is necessary, because Portal renders by default outside of shadow-dom
emotionOptions={{
container: emotionRoot, // with this line, emotion renders styles inside the shadow dom element created before
key: 'mantine',
}}
>
Hello World!
</MantineProvider>,
mountPoint
); |
Beta Was this translation helpful? Give feedback.
-
@rtivital Looking for some guidance along this topic. I am federating my application into a shadow DOM container, and I am having some issue with the DatePicker. When I click on the input field, the DatePicker opens just fine, but when I try clicking a date or any of the controls, the picker immediately closes without making a selection. Here is my configuration: // `props.root` is the shadow DOM element
const cache = useMemo(() => createEmotionCache({
key: 'orion',
container: props.root
}), []);
return (
<MantineProvider
emotionCache={ cache }
theme={ {
components: {
Portal: {
defaultProps: {
target: props.root
}
}
}
} }
withCSSVariables
withGlobalStyles
withNormalizeCSS>
<DatePicker
label="Test"
inputFormat="MM/DD/YYYY"
labelFormat="MM/YYYY"
my="lg"
clearable={ false }
withAsterisk
withinPortal />
</MantineProvider>
); I am able to use my keyboard to make selections... did notice this error after pressing the tab key:
Here is a recording of this behavior Screen.Recording.2022-11-16.at.10.27.37.AM.movUpdateI have also tried this without using the |
Beta Was this translation helpful? Give feedback.
My case is not an iframe, but the shadow-dom, but I think is the same.
What worked for me was