JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<h2>This is a very long heading that should wrap with ellipsis when too long, but have a button to it's right.</h2>
</div>
CSS
.container {
display: inline-block;
max-width:100%;
position: relative;
}
h2 {
padding-right: 200px;
box-sizing: border-box;
width: 100%;
display: inline-block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
/* word-wrap: break-word; caused issues in IE */
max-width: -moz-calc(100% - 200px); /* FF hack */
}
button {
position: absolute;
width: 100px;
right: 95px;
top: 2em;
}