JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<textarea>asddas dasdasdas asdas</textarea>
<div class="txt-underline"></div>
</div>
CSS
body{
background-color: #ffffff;
}
textarea{
width: 100%;
border: 0;
outline: 0;
}
.txt-underline{
background-color: rgba(0,0,0,0.12);
height: 1px;
width: 100%;
}
.txt-underline.active{
background-color: #673ab7;
height: 2px;
}
JavaScript
$(function(){
$('body').on('focus', 'textarea', function(){
$(this).next().addClass('active');
});
$('body').on('focusout', 'textarea', function(){
$(this).next().removeClass('active');
});
});