One feature we use pretty extensively at work is React portals, whereby a fragment of the component tree is mounted to a DOM element outside the DOM hierarchy. This is really convenient for things like menu’s.
Is there anyway to do this in Elm?
Not directly, I don’t think. This would probably have to be done via ports or a web component. If you want it to work exactly the same, you could probably make a web component that had some actual React code with a portal in it.
There are also ways to implement elements “breaking-out” their container in pure Elm without portals, for example:
See A "popout" implementation in Elm for details.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.