Socket
Socket
Sign inDemoInstall

react-sticky-mouse-tooltip

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sticky-mouse-tooltip

React tooltip component that follow mouse cursor. You can pass as this tooltip children any HTML element or other React component.


Version published
Maintainers
1
Created
Source

react-sticky-mouse-tooltip

React tooltip component that follow mouse cursor. You can pass as this tooltip children any HTML element or other React component.

Component functionality preview

Installation

npm install react-sticky-mouse-tooltip --save

or

yarn add react-sticky-mouse-tooltip

Example

import React from 'react';
import MouseTooltip from 'react-sticky-mouse-tooltip';

class Preview extends React.Component {
  state = {
    isMouseTooltipVisible: false,
  };

  toggleMouseTooltip = () => {
    this.setState(prevState => ({ isMouseTooltipVisible: !prevState.isMouseTooltipVisible }));
  };

  render() {
    return (
      <div>
        <button onClick={this.toggleMouseTooltip} style={buttonStyle}>
          Toggle mouse tooltip
        </button>
        <MouseTooltip
          visible={this.state.isMouseTooltipVisible}
          offsetX={15}
          offsetY={10}
        >
          <span>Follow the cursor!</span>
        </MouseTooltip>
      </div>
    );
  }
}

Attributes

AttributeDescriptionTypeRequiredDefault value
visibleVisibility of component.booleanNotrue
offsetXOffset along X axis.numberNo0
offsetYOffset along Y axis.numberNo0
classNameTooltip div class name.stringNo-
styleStyles properties of tooltip div.objectNo-

License

MIT

Keywords

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc