How to show Tooltip only onClick in react toolbox

4.1k Views Asked by At

There is a Tooltip example in react-toolbox offical docs. How can i show Tooltip only onClick event on Input.

1

There are 1 best solutions below

0
arikanmstf On

If you don't want to show tooltip on mouse enter, you should fork the project and make following changes:

at components/tooltip/Tooltip.js:

handleMouseEnter = (event) => {
        this.activate(this.calculatePosition(event.currentTarget));
        if (this.props.onMouseEnter) this.props.onMouseEnter(event);
      };

handleMouseLeave = (event) => {
        this.deactivate();
        if (this.props.onMouseLeave) this.props.onMouseLeave(event);
      };

TO

handleMouseEnter = (event) => {
        return false;
      };

handleMouseLeave = (event) => {
        return false;
      };