JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="document.execCommand('bold',false,null);">Bold</button><br/>
       
<div id='input' contenteditable='true' onclick="document.execCommand('selectAll',false,null);document.execCommand('bold',false,null);">
   select some of this text and then hit one of the buttons above
</div>