vuejs toggle class – vue js v-class – Dynamic Components in Vuejs

We can pass some an object data to v-bind:class using vue to dynamically toggle switch on or off classes and A common reqired to need for your data binding is manipulating some an element’s add or remove class list and its new inline styles.

Dynamically Binding Styles

Vue.js some allows for binding styles suppoted and classes dynamically (add or remove class using vuejs) to elements with the directives of vuejs (v-bind:style) and (v-bind:class) directives.

Binding Dynamic multiple styles to an HTML element : Example 1

  Increase your font size here in Example
  Decrease your font size here in Example

  Your Dynamic Font size is: {{ fontSize }}

data: {
  isenable: true,
  isdisable: false

index.html : Example 2

  <title>VueJS Simple Example</title>

      <button class="btn">
        <span class="fa fa-power-off"></span>



new Vue({
  el: 'body',
  data: {
    livecol: true
  methods: {
    flipSwitch: function() {
      this.livecol = !this.livecol;


.body-on {
  background-color: #4285F4;
.body-off {
  background-color: #FBBC05;
.height-2 {
  min-height: 10em;
.btn {
  border-radius: 5em;
  height: 100px;
  width: 100px;
  outline: none;
  background: none 0;
  border: solid thin #444444;
  color: #eeeeee;
  font-size: 3em;
.btn-danger {
   background-color: purple;
   color: #4285F4;
.btn-success {
  background-color: green;
  color: #FBBC05;
.text-center {
   text-align: center;


READ :  Difference between Class and Structure in C#.NET