<Transition> Enter/Leave Transitions

Last updated: 2026-10-22

<Transition> Enter/Leave Transitions

wraps a single element or component and applies transition classes or hooks when it enters or leaves.

GroupBuilt-ins
KindComponent / Element
ScopeTemplate
Vue Version3.0+
SSR SupportYes

📝 Syntax

<Transition name="fade">
  <p v-if="show">content</p>
</Transition>

/* classes: fade-enter-active / fade-enter-from / fade-enter-to (same for leave) */
.fade-enter-active { transition: opacity .3s }
.fade-enter-from { opacity: 0 }

⚙️ Arguments

propsname (class prefix), appear, mode (out-in...), duration and css:false for JS hooks

▶ Example

Edit the code below and see the live result:

Output:

Toggling fades the paragraph out and back in over ~0.3s.

💡 Key Points

💡 Tip The name prefixes the classes; the default prefix is v-.
⚠️ Warning Exactly one child is allowed — use TransitionGroup for lists.
ℹ️ Note mode="out-in" waits for the leave to finish before entering.
More case studies coming soon.

📚 Related Tutorials

❓ FAQ

Q Why is nothing animating?
A Usually missing CSS or a mismatched class prefix.
Q Can CSS and hooks combine?
A Yes, though css:false leaves control to hooks alone.
Q How about list animations?
A Use <TransitionGroup>, which adds a .move class.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏