Here is a simple demo showcasing blocks with tooltips that appear when hovered over. However, there seems to be an issue with the functionality.
The tooltip should ideally be displayed either from the left or right side of the block. To determine the size and position of the tooltip accurately, it needs to be displayed first. The calculation for positioning the tooltip can only be done after it is visible.
You can view the code on CodeSandbox here
// JavaScript code...
.block {
// CSS styles...
}
.hover-block {
// CSS styles...
}
.hidden {
display: none;
}
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
<div id="root"></div>