JSFiddle - React, Tailwind, and code Playground
by NunoMira
HTML
<div style="background-color:blue;">
<textarea id="message" rows="1"></textarea>
</div>
CSS
textarea
{
vertical-align:bottom;
resize: none;
padding: 0;
overflow: hidden;
height: auto;
background-color:red;
}
JavaScript
//AutoSize TextArea verticalmente
var i=0;
$(function()
{
var objTextArea = $("#message");
objTextArea.on('input', function()
{
objTextArea.css("height",0);
objTextArea.css("height", objTextArea[0].scrollHeight + 'px');
});
});