JSFiddle - React, Tailwind, and code Playground
HTML
<input placeholder="Type something">
JavaScript
const textControl = document.querySelector("input");
textControl.addEventListener("beforeinput", () => {
textControl.style.display = textControl.style.display == "block" ? "inline" : "block";
});
textControl.addEventListener("input", event => {
console.log(textControl.getBoundingClientRect());
});
textControl.focus();