v-show Toggle Visibility via CSS

Last updated: 2026-10-22

v-show Toggle Visibility via CSS

v-show toggles the element's display style from the expression. The element always stays in the DOM — only visibility changes.

GroupDirectives
KindDirective
ScopeTemplate
Vue Version3.0+
SSR SupportYes

📝 Syntax

<p v-show="isVisible">Now you see me</p>

⚙️ Arguments

expressionAny truthy/falsy expression

Returns:Directive, no return value

▶ Example

Edit the code below and see the live result:

Output:

Toggling hides/shows the text while the element remains in the DOM with display: none.

💡 Key Points

💡 Tip For frequent toggling v-show is cheaper — it only flips CSS, no DOM churn.
ℹ️ Note When initially falsy the element still renders (kept in place), costing more up-front.
⚠️ Warning v-show does not support v-else — it is a style toggle, not a branching directive.
More case studies coming soon.

📚 Related Tutorials

❓ FAQ

Q v-show or v-if — which one?
A Frequent toggling → v-show (CSS only). Rare changes or lazy rendering → v-if.
Q Does DevTools still show a v-show-hidden element?
A Yes, the element stays in the DOM with display: none.
Q Can v-show be paired with v-else?
A No — v-show is not a branching directive; use v-if / v-else for exclusive rendering.
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%

🙏 帮我们做得更好

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

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