JSFiddle - React, Tailwind, and code Playground

by panamaprophet

HTML

<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div id="app"> 
  <transition name="fade">
    <div v-if="switc" class="target">
      <div style="background-color: pink; padding: 20px; margin-bottom: 20px;">
      	<p>
		Text that could be of any length because it comes from a database.
		</p>
		<textarea style="resize: vertical;">
			Textarea that the user can resize
		</textarea>
      </div>
   </div>
   </transition>
   <button type="button" class="btn btn-secondary" @click="switc = !switc">
     <span>Switch</span>
   </button>
</div>

CSS

.fade-enter-active, .fade-leave {
  max-height: 300px;
}
.fade-enter, 
.fade-leave-active {
  max-height: 0;
}

.target {
  transition: all 1.5s;
  overflow: hidden;
  max-height: auto;
}

JavaScript

var app = new Vue({
  el: '#app',
  data: {    
      switc: false
  }
})