JSFiddle - React, Tailwind, and code Playground
HTML
<div style="width:50%">
<label id="mlbl">text</label>
</div>
<button id="mbtn">click</button>
CSS
label{
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 100%;
}
JavaScript
$('#mbtn').click(function(){
$('#mlbl').text('asdasda gfgfg ad ad asd ad asd 12 asd ad ad ')
});