1.0.7 • Published 2 years ago

react-dimmer v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-dimmer

react-dimmer is an easy to use React component that allows you to dim your app's background while a menu / modal is open, in order to get the user's focus on it.

Watch the demo

Usage

First, install as a npm package in your project:

npm i react-dimmer

Import the package from node_modules

import { ReactDimmer } from 'react-dimmer'

And finally use:

<ReactDimmer isOpen={isMenuOpen} exitDimmer={setMenuOpen} />

In order to use this correctly, use the useState hook:

const [isMenuOpen, setMenuOpen] = useState(false)
  • isMenuOpen - a boolean that determines whether a menu / modal etc... is open
  • setMenuOpen - a react setState function passed into ReactDimmer, in order to set the menu / modal close once the dimmer is clicked

Options

You can use these options to style the dimmer:

(all of the properties must be passed as numbers)

PropDescriptionDefault valueRange
zIndexset the z-index property of the dimmer100all numbers
opacityset the opacity in precentage0.50 - 1
blurset the background's blur00 - infinity
saturateset the background's saturation1000 - 100
transitionset the speed of the dimmer appearens in seconds0.30 - infinity

More Info

This package was easy to build thanks to TSDX, Check it out

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago