# react-modal-hover

Latest version **1.1.13** (published 2021-06-12) · 0 weekly downloads

## Install

```sh
npm install react-modal-hover
pnpm add react-modal-hover
yarn add react-modal-hover
bun add react-modal-hover
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.13 |
| Published | 2021-06-12 |
| First published | 2021-06-04 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 314.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | @carlostorreswav |
| Maintainers | carlostorreswav |
| Keywords | react, component, ui, modal, hover, info |

## Links

- npm: https://www.npmjs.com/package/react-modal-hover
- Repository: https://github.com/carlostorreswav/react-modal-hover
- Homepage: https://github.com/carlostorreswav/react-modal-hover#readme
- Issues: https://github.com/carlostorreswav/react-modal-hover/issues
- npm.io page: https://npm.io/package/react-modal-hover

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 1.1.13 (latest) — 2021-06-12
- 1.1.12 — 2021-06-12
- 1.1.11 — 2021-06-12
- 1.1.10 — 2021-06-11
- 1.1.9 — 2021-06-11
- 1.1.8 — 2021-06-11
- 1.1.7 — 2021-06-11
- 1.1.6 — 2021-06-11
- 1.1.5 — 2021-06-10
- 1.1.4 — 2021-06-10
- 1.1.1 — 2021-06-10
- 1.1.0 — 2021-06-10
- 1.0.9 — 2021-06-08
- 1.0.8 — 2021-06-08
- 1.0.7 — 2021-06-07
- … 14 more at https://npm.io/package/react-modal-hover/versions

## README

# __react-modal-hover__

<img src="shared/rmh.gif" alt="drawing" style="width:500px"/>

<br>

## __How it works 🤔__
Hovering over the desired component will open a modal with another component shown as information
<br>
Take care with the `width` of the element you want to hover 🤟

### __There are 3 main elements on this component:__
####  __1 - Content__: the element to show when user hover the element
####  __2 - Legend__: the element to make users know some element is hoverable

####  __3 - Background__: a black transparent window when you hover


<br>

### 🚀 __Live Demo: https://onlyMastering.com/devmode__
<br>

## ✨ __Quick Start__ ✨
### __Install package from npm__ 📥
```npm i react-modal-hover```

### Import it on your .js 📥
```import { ModalHover } from 'react-modal-hover'```

### Prepare your "onHover" component or just a simple string

```
<ModalHover onHover={<h3>Hello World</h3>}>
  <div>Hover Me!</div>
<ModalHover/>
```
ℹ️ it's recommended to use ```<div>``` as first child, then whatever you want 😃
<br>

## __General Props__

ℹ️ Main props of the component, *legendMsg* is __?__ because is the typical tooltip map legend
<br>
ℹ️ if option `active={false}` ModalHover will not be even visible on the html

|Option|Type|Default|Description|
|-------------|:-------------:|:-------------:|:-------------:|
|__active__|boolean|true|activate all the hover option
|__legend__|boolean|true|legend on top of your hover component
|__legendPos__|string|right|position of the legend on your hover component
|__legendMsg__|string|?|message of the legend

### __Example__

```
<ModalHover onHover={<MySocialMediaComponent/>} legendPos="left" legendMsg="Follow me!">
  <div>Author: Carlos Torres</div>
<ModalHover/>
```
<br>

## __Styled Props (CSS)__

ℹ️ Styling props, you can add it on objects or direct CSS, check examples below
### __BackgroundStyles__

|Option|Type|Default|Description|
|-------------|:-------------:|:-------------:|:-------------:|
|__backgroundColor__|string|rgba(0, 0, 0, 0.75)|background-color, better with some transparency|

<br>

### __ContentStyles__

|Option|Type|Default|Description|
|-------------|:-------------:|:-------------:|:-------------:|
|__backgroundColor__|string|rgba(0, 0, 0, 1)| content css property|
|__maxWidth__|string|100%| content css property|
|__borderRadius__|string|8px| content css property|
|__boxShadow__|string|0 0 10px 2px black| content css property|
|__color__|string|white| content css property|
|__padding__|string|10px 20px| content css property|
|__border__|string|2px solid grey| content css property|
|__marginLeft__|string|20px| content css property|
|__marginRight__|string|20px| content css property|


#### __Example with object__
```
const MyContentStyles = {
    backgroundColor: "white",
    color: "black",
    padding: "20px 40px"
}
...
<ModalHover ContentStyles={MyContentStyles} onHover={<MyCompOnHover/>} legendMsg="HOVER ME!">
  <div>Im a div that wants to be hovered</div>
<ModalHover/>
```

<br>

### __LegendStyles__

|Option|Type|Default|Description|
|-------------|:-------------:|:-------------:|:-------------:|
|__color__|string|white| Legend css property|
|__backgroundColor__|string|orange| Legend css property|
|__borderRadius__|string|50px| Legend css property|
|__minHeight__|string|20px| Legend css property|
|__minWidth__|string|20px| Legend css property|
|__padding__|string|2px 2px| Legend css property|
|__display__|string|flex| Legend css property|
|__justifyContent__|string|space-around| Legend css property|
|__alignItems__|string|center| Legend css property|
|__cursor__|string|pointer| Legend css property|
|__boxShadow__|string|0 0 5px 0 black| Legend css property|
|__fontSize__|string|16px| Legend css property|
|__fontWeight__|string|bold| Legend css property|
|__marginTop__|string|0px| Legend css property|
|__marginLeft__|string|0px| Legend css property|

#### __Example with direct css insert (just like in React)__
```
<ModalHover
    ContentStyles={{color:"red", padding:"20px"}}
    LegendStyles={{backgroundColor:"red"}}
    onHover={<MyCompOnHover/>}
    legendMsg="info"
    >
  <div>Im other div that wants to be hovered</div>
<ModalHover/>
```

<br>

## __Fades__

ℹ️  You can set fade-in/out props to the background and the content, do it carefully ⚠️ :

|Option|Type|Default|Description|
|-------------|:-------------:|:-------------:|:-------------:|
|backFadeIn|string|1s ease|recommended fade in for background|
|backFadeOut|string|.3s ease|recommended fade out for background|
|contFadeIn|string|1s ease|recommended fade in for content|
|contFadeOut|string|.3s ease|recommended fade out for content|
#### __Example with Fades__
```
<ModalHover
    Fades={{backFadeIn:".5s linear", contFadeIn:".5s linear"}}
    legendMsg="info"
    >
  <div>Im other div that wants to be hovered</div>
<ModalHover/>
```
<br>

### __TypeScript__
This package does support TypeScript 🥰

<br>

# __Follow me! ✨__

__GitHub__ | <a href="https://github.com/carlostorreswav">@carlostorreswav<a/><br>
__Twitter__ | <a href="https://twitter.com/carlostorreswav">@carlostorreswav<a/><br>
__Linkedin__ | <a href="https://www.linkedin.com/in/carlos-torres-a8a459213/">Carlos Torres<a/>

### TypeScript support thanks to @ciensprog 🧡

---
_Source: https://npm.io/package/react-modal-hover · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
