Multiple portals in the DOM #264
Answered
by
KevinVandy
Sergey7709
asked this question in
Q&A
-
Please clarify why the table creates so many in the DOM? Is there any way to change this? |
Beta Was this translation helpful? Give feedback.
Answered by
KevinVandy
Feb 5, 2024
Replies: 1 comment 1 reply
-
They're for tooltips, popovers, menus and modals. You can lower the amount of these portals by making all Mantine tooltips share 1 portal. In my Mantine theme, I do: <MantineProvider
theme={createTheme({
//...
components: {
//...
Tooltip: {
defaultProps: {
withArrow: true,
portalProps: {
target: '.mantine-tooltips', // all tooltips share 1 portal
},
},
},
//..
},
})}
>
{children}
</MantineProvider> and then just make an empty div in the body of my HTML with that class. Not really practical to do the same for Modals, Popovers and menus, as they can sometimes need to both be on screen at once, but this makes sense for Tooltips. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Sergey7709
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
They're for tooltips, popovers, menus and modals. You can lower the amount of these portals by making all Mantine tooltips share 1 portal. In my Mantine theme, I do:
and then just make an empty div in the body of my HTML with that class.
Not really practical to do the same for Modals, Popovers and menus, as they can sometimes need to both be on screen at once…