JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="ta"></textarea>
CSS
#ta {
width:250px;
min-height:116px;
resize:none;
}
JavaScript
$("#ta").keyup(function (e) {
autoheight(this);
});
function autoheight(a) {
if (!$(a).prop('scrollTop')) {
do {
var b = $(a).prop('scrollHeight');
var h = $(a).height();
$(a).height(h - 5);
}
while (b && (b != $(a).prop('scrollHeight')));
};
$(a).height($(a).prop('scrollHeight') + 20);
}
autoheight($("#ta"));