• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React hover --- make hover easy http://cht8687.github.io/react-hover/example/

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

Circle CI NPM Version Coverage Status Build Status Downloads License

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 [email protected]: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:

More Repositories

1

React-ES5-To-ES6-Checklist

๐Ÿ“˜The missing manual of upgrading ES5 React to ES6+ โœจ
JavaScript
106
star
2

react-listview-sticky-header

react listview with sticky section header
JavaScript
80
star
3

TSA

Using React-Native and Redux to create the TSA $1.4 million iOS and Android app
Objective-C
68
star
4

mingify

Mingify anything!
JavaScript
42
star
5

react-expandable-listview

React expandable components, assist you render expandable objects or React components
JavaScript
37
star
6

react-text-collapse

React text collapse/expand with React-Motion...
JavaScript
19
star
7

angular-redux-starter-kit

Angular + Angular-Redux (@angular-redux/store) + Bootstrap + Font-awesome starter. Simple yet extendable.
TypeScript
6
star
8

react-accordion

React accordion component --- Convert a pair of headers and content panels into an accordion using React, React-motion
JavaScript
5
star
9

code-warehouse

Code Snippets, algorithms, practice...
JavaScript
3
star
10

string-remove

Remove any unwanted stuffs in string
JavaScript
2
star
11

diff-at

Return the index of first difference occurring between given string, number or array
JavaScript
2
star
12

react-webpack-starter-kit

React Webpack Starter Kit--- no Flux, Redux, Reflux, chose your own framework...
JavaScript
2
star
13

year-of-dog

Check if the year is year of dog in Chinese Zodiac
JavaScript
2
star
14

HL-minigames

react-pixi mini-games starter kit
JavaScript
1
star
15

blog

my blog site
HTML
1
star
16

cht8687

1
star
17

cht8687.github.io

JavaScript
1
star
18

react-timeline-d3

A event based d3 timeline built for React
1
star
19

fp-ts-string-uniq

string uniq util function
TypeScript
1
star
20

awards

repo to host a collection of personal awards
1
star
21

nsw-vaccine-tracker

small termal program to track available slots
JavaScript
1
star
22

react-busy

Show busy/loading indicators whenever you like.
JavaScript
1
star
23

react-tooltip

react tooltip
JavaScript
1
star
24

covid-19-global

Global site for tracking covid-19
JavaScript
1
star