Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mantine UI Series] Portal & wthinPortal Property #5

Open
reboottime opened this issue Jul 6, 2023 · 1 comment
Open

[Mantine UI Series] Portal & wthinPortal Property #5

reboottime opened this issue Jul 6, 2023 · 1 comment

Comments

@reboottime
Copy link
Owner

reboottime commented Jul 6, 2023

Portal

  1. The createPortal function allows you to render certain children into a different part of the DOM, such as displaying a modal or a drawer outside of the current DOM structure.

  2. One notable thing about createPortal is we can't use it on the server side. This is why, in the Portal source code of Manine UI, the createPortal function is invoked after the entire component has been mounted.

@reboottime
Copy link
Owner Author

reboottime commented Jul 6, 2023

The withinPortal property in some of Mantine UI components

In Mantine UI, there are several components that support rendering components part using Portal, such as Drawer, Modal, Popover and Select via supporting withInPortal property.

When using a portal to render a component part under the body element, there are several things to consider

  • Locate the component part at where such that there is no content cut off when the zone left is not enough to cover portal content
  • Adjust the portal's content position correspondingly to match UI effect needs
  • How to handle scroll, resizing interaction while keeping the UI position right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant