3.0.1 • Published 4 years ago

react-hover v3.0.1

Weekly downloads
1,018
License
MIT
Repository
github
Last release
4 years ago

React Hover --- Turn anything to a 'hoverable' object

React hover

Installation

npm

$ npm install --save react-hover

Codesandbox Demo

Codesandbox example

Demo

Demo

Usage

You can turn plain HTML or your custom trigger/hover components in React-hover.

Below is the example of custom components:

<ReactHover options={optionsCursorTrueWithMargin}>
  <Trigger type="trigger">
    <TriggerComponent />
  </Trigger>
  <Hover type="hover">
    <HoverComponent />
  </Hover>
</ReactHover>

Or plain HTML element:

<ReactHover options={optionsCursorTrueWithMargin}>
  <Trigger type="trigger">
    <h1 style={{ background: '#abbcf1', width: '200px' }}> Hover on me </h1>
  </Trigger>
  <Hover type="hover">
    <h1> I am hover HTML </h1>
  </Hover>
</ReactHover>

Options

options: PropTypes.object.isRequired

Set the options.

const options = {
  followCursor: true,
  shiftX: 20,
  shiftY: 0,
}

followCursor: define if hover object follow mouse cursor shiftX: left-right shift the hover object to the mouse cursor shiftY: up-down shift the hover object to the mouse cursor

type

type: PropTypes.string

Set the type.

<Trigger type='trigger'>
<Hover type='hover'>

This prop defines the type name. It must be declared as above if you minify your code in production.

Development

$ git clone git@github.com:cht8687/react-hover.git
$ cd react-hover
$ npm install
$ npm run dev

Then

open http://localhost:8080/webpack-dev-server/

Want to buy me a coffee?

ko-fi

License

MIT

Contributors

Thanks to these wonderful developers for helping this project:

3.0.1

4 years ago

3.0.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

5 years ago

1.4.0

6 years ago

1.3.5

6 years ago

1.3.4

7 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago