Skip to content
masterclass Buddy

Vue.js · Directive

v-if

Use v-if to render content only when a condition is truthy. Use v-else-if and v-else for branches, or v-show to keep content in the DOM and toggle its display.

Last updated

Syntax

v-if="expression"

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • v-else
  • v-else-if
  • v-show
  • v-for
  • <template>

Source: Conditional Rendering | Vue.js. Checked 2026-11-03.