JSFiddle - React, Tailwind, and code Playground

HTML

<div>
This is some text. This is some text. This is some text. This is some text.
</div>

<button>
Toggle Width
</button>

CSS

div {
  border: 1px solid black;
  resize: horizontal;
  display: box;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 50px;
  width: 300px;
}

div.small {
  width: 200px;
}

JavaScript

document.querySelector('button').addEventListener('click', () => {
	document.querySelector('div').classList.toggle('small');
});