Skip to content

Multiple portals in the DOM #264

Answered by KevinVandy
Sergey7709 asked this question in Q&A
Discussion options

You must be logged in to vote

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…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sergey7709
Comment options

Answer selected by Sergey7709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants