JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="mytext"></textarea>

CSS

textarea{
    height:400px;
}

JavaScript

var count= 1;
var chars= 3;
$('#mytext').keyup(function() {
        var v = $(this).val();
        var vl = v.replace(/(\r\n|\n|\r)/gm,"").length;   
    if (parseInt(vl/count) == chars) {
        $(this).val(v + '\n');
    count++;
    }
});