JSFiddle - React, Tailwind, and code Playground
HTML
<p class="card-text message-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error est libero, ut esse omnis aut voluptatum quod suscipit dolor molestias magnam temporibus porro provident, incidunt repellat blanditiis laborum. Repellendus, temporibus.</p>
JavaScript
$('.card-text').each(function() {
var $this = $(this);
var text = $this.html();
$this.data('full-text', text);
var small = text.substring(0, 20);
if(small.length < text.length) {
$this.html(small);
var $button = $('<button>...</button>');
$button.click(function() {
$this.html($this.data('full-text'));
})
$this.append($button);
}
})