Tag : v-if-vs-v-show

VueJs Series with Nirmal : Difference between v-if and v-show

Welcome to the VueJs series with Nirmal.


The control structure followed by VueJs for the UI element rendering. v-if supports the control branching if..else if..else.

A quick example to render spans based on the value typed in the input.

It renders the “Fruits” and “Birds” span when typed “Fruits” and “Birds” in the input text respectively. Otherwise it renders “Animal” span.


A boolean control to manage display of an UI element.

As the “show_sky” variable used in this example, depending on that it either displays the span or hides it.

v-if vs v-show

  • Unlike v-if, v-show has no else part
  • v-if only renders the elements which satisfies the condition. But v-show, renders all elements and manages with css “display” attribute.


The video contains the demonstration of v-if vs v-show

Hope this helps.

Categories: VueJs

%d bloggers like this: