diff --git a/docs/api/portal-target.md b/docs/api/portal-target.md index 13f1c94..cfd32b0 100644 --- a/docs/api/portal-target.md +++ b/docs/api/portal-target.md @@ -138,29 +138,116 @@ Example:

This is rendered when no other content is available.

``` -### `wrapper` +### `v-slot:sourceWrapper` -This slot can be used to define markup that should wrap the content received from a ``. This is usually only useful in combination with [`multiple`](#multiple), as for content from a single portal, you can just wrap the `` as a whole. +This Slot allows to wrap each individual item from a portal (or `multiple` portals) in additional markup. The slot receives an array of `VNodes`: + +```html + +

Some inline content

+

Some more content

+
+ + +

Some content from a second portal

+
-The slot receives an array as its only prop, which contains the raw vnodes representing the content sent from the source portal(s). +
+ + + +
+``` -These vnodes can be rendered with Vue's dynamic component syntax: +**Result** + +```html +
+
+

Some inline content

+

Some more content

+
+
+

Some content from a second portal

+
+ +
+``` + +### `v-slot:itemWrapper` + +This slot can be used to define markup that should wrap the content received from a ``. This is usually only useful in combination with [`multiple`](#multiple), as for content from a single portal, you can just wrap the `` as a whole. + +The slot receives a single vnode as its only prop. These vnodes can be rendered with Vue's dynamic component syntax: `` -Example: +```html + +

Some inline content

+

Some more content

+
+ + +

Some content from a second portal

+
+ +
+ + + +
+``` + +**Result** + +```html +
+
+

Some inline content

+
+
+

Some more content

+
+
+

Some content from a second portal

+
+ +
+``` + +### `v-slot:outerWrapper` + +This slot is similar to `itemWrapper`, but it will be called only once, and receive *all* vnodes in an array. That allows you to wrap all received content in a shared wrapper element. + +Usually, this slot is not very useful as you can instead just put the wrapper around the ``itself. But it's useful for transition groups which would otherwie conflict with the ``'s own root element: -**Source** - ```html - -