Mantine modals not rendering + styles are broken
I'm using a modal with https://mantine.dev/ but it's not rendering on the screen. When I inspect the modal, I'm only then able to see it on the bottom of the page and the mantine styles are not being applied to it
AppShell demo
React components and hooks library with native dark theme support and focus on usability, accessibility and developer experience
18 Replies
@MoreThanYourAverageJoe has reached level 4. GG!
I think there'sa gotcha with Mantine modal - you must tell it where to mount its container
otherwise, it will by default mount on top of the document.body
would I have to mount it to a container than override it's position and z-index to make it overlay over the center of the screen?
that doesn't explain the styles not applying though
is that mantine DOM element being injected into the body?
if so, that's why. The style are injected into the shadowDOM that houses the CSUI component
yes
yeah, it's in the body right
yeh
not inside
plasmo-csui
no
yup, so you will just need to tell the Modal container to target the right component to mount onto
you can even use an
useRef
as wellis there somewhere in the docs talkign about injecting into plasmo-csui using shadow element
hmmm let me look into that actually that would be bette
check out the docs on CSUI
but you shouldn't need to worry about it at all
use VDOM
leverage the react abstractions
you're referring to
getOverlayAnchor
from the docs right?
i'm kind of a noob, I'm not sure how I'd even access elements using useRef
that aren't in my .tsx
fileno, you can actually reference a stray element inside your component itself
no anchor needed
i.e
put a span inside your component
and add an useRef into your component
then, reference it in the container
is there any examples I can look at?
I think I'm just too tired it's late here
lol get some sleep
it's 3AM on my end too xd
but the idea is this:
and there's no example on this exact cases
Modal
Modal with optional header