Skip to content

Commit 4e9f325

Browse files
committed
feat: add migration guide > transition group root element
1 parent 5c63b27 commit 4e9f325

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Transition Group Root Element
3+
badges:
4+
- breaking
5+
---
6+
7+
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
8+
9+
## Overview
10+
11+
`<transition-group>` no longer renders a root element by default, but can still create one with the `tag` prop.
12+
13+
## 2.x Syntax
14+
15+
In Vue 2, `<transition-group>`, like other custom components, needed a root element, which by default was a `<span>` but was customizable via the `tag` prop.
16+
17+
```html
18+
<transition-group tag="ul">
19+
<li v-for="item in items" :key="item">
20+
{{ item }}
21+
</li>
22+
</transition-group>
23+
```
24+
25+
## 3.x Syntax
26+
27+
In Vue 3, we have [fragment support](/guide/migration/fragments.html), so components no longer _need_ a root node. Consequently, `<transition-group>` no longer renders one by default.
28+
29+
- If you already have the `tag` prop defined in your Vue 2 code, like in the example above, everything will work as before
30+
- If you didn't have one defined _and_ your styling or other behaviors relied on the presence of the `<span>` root element to work properly, simply add `tag="span"` to the `<transition-group>`:
31+
32+
```html
33+
<transition-group tag="span">
34+
<!-- -->
35+
</transition-group>
36+
```
37+
38+
## See also
39+
40+
- [Some transition classes got a rename](/guide/migration/transition.html)

0 commit comments

Comments
 (0)