You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,13 +111,23 @@ Normally in `ComponentA`/`ComponentB` examples like the above, switching from `C
111
111
112
112
How does it work under the hood?
113
113
114
-
### `portals.createHtmlPortalNode`
114
+
### `portals.createHtmlPortalNode([options])`
115
115
116
116
This creates a detached DOM node, with a little extra functionality attached to allow transmitting props later on.
117
117
118
-
This node will contain your portal contents later, within a `<div>`, and will eventually be attached in the target location. Its plain DOM node is available at `.element`, so you can mutate that to set any required props (e.g. `className`) with the standard DOM APIs.
118
+
This node will contain your portal contents later, within a `<div>`, and will eventually be attached in the target location.
119
119
120
-
### `portals.createSvgPortalNode`
120
+
An optional options object parameter can be passed to configure the node. The only supported option is `attributes`: this can be used to set the HTML attributes (style, class, etc.) of the intermediary, like so:
The div's DOM node is also available at `.element`, so you can mutate that directly with the standard DOM APIs if preferred.
129
+
130
+
### `portals.createSvgPortalNode([options])`
121
131
122
132
This creates a detached SVG DOM node. It works identically to the node from `createHtmlPortalNode`, except it will work with SVG elements. Content is placed within a `<g>` instead of a `<div>`.
0 commit comments