JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box">
<span class="tooltip">какой то текст</span>
</div>
CSS
.box {
width: 200px;
height: 200px;
background: red;
}
.tooltip {
display: none;
position: fixed;
}
.box:hover .tooltip {
display: block;
}
JavaScript
var tooltip = document.getElementsByClassName('tooltip')[0];
window.onmousemove = function (e) {
const x = e.clientX,
y = e.clientY;
tooltip.style.left = (x + 10) + 'px';
tooltip.style.top = (y + 10) + 'px';
};