JSFiddle - React, Tailwind, and code Playground
HTML
<ol class="list">
<li><textarea></textarea><a class="add" href="#">Add another</a></li>
<li><textarea></textarea><a class="add" href="#">Add another</a></li>
</ol>
CSS
ol li {
position: relative;
}
ol li .add {
display: none;
position: relative;
animation-name: slide;
animation-duration: 0.5s;
}
ol li:last-child .add {
display: block;
}
.list li textarea {
animation-duration: 0.5s;
animation-name: append;
}
@keyframes slide {
from {
bottom: 100%;
}
to {
bottom: 0%;
}
}
@keyframes append {
from {
transform: translateX(10%);
opacity: 0;
}
to {
transform: none;
opacity: 1;
}
}
JavaScript
$(function(){
var row = $('<li><textarea></textarea><a class="add" href="#">Add another</a></li>');
$('.list').on('click', '.add', function(e){
e.preventDefault();
$('.list').append(row.find('textarea').height(80).end().clone());
});
});