JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <label id="mlbl">text</label>
</div>
<button id="mbtn">click</button>

CSS

div{
    overflow: hidden;
    position: relative;
    width: 50%;
    height: 50px;
}

label{
    display: block;
    min-width: 100%;
    overflow: hidden;
    position: absolute;
    top: 0;
    right: 0;
    white-space: nowrap;
    
}

JavaScript

$('#mbtn').click(function(){
$('#mlbl').text('This a very lonng text with stuff and this is the end.')

});