Vue Slide Transition

Vue Slide up/down transition

by Mladen Mihajlovic

HTML

<div id="app">
  <h1>Vue Slide</h1>
  <label>
    <input type="checkbox"  v-on:change="toggle = !toggle"  :value="toggle"> Toggle
  </label>
  <div class="wrapper">
    <transition name="slide">
      <div v-if="toggle">
         The sample text <br>
         Testing Vue Slide Transition
      </div>
    </transition>
  </div>
</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
  height: 200px;
}
h1{
  font-size: 24px;
}
.wrapper {
  margin-top: 10px;
  position:relative;
  overflow: hidden;
}
.slide-enter-active, .slide-leave-active  {
  transition: all .6s ease;
}
.slide-enter, .slide-leave-to
{
  transform: translateY(-100%);
  opacity: 0;
}

Vue

new Vue({
  el: "#app",
  data: {
    toggle: false
  }
})