0.1.5 • Published 4 years ago

simple-react-modal-easy-use v0.1.5

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

Simple React Modal Easy Use

This is package contains a simple React Modal that is easy to use and manipulate.

Installation

Npm:

npm i simple-react-modal-easy-use

Yarn:

yarn add simple-react-modal-easy-use

How to use

import Modal from  'simple-react-modal-easy-use';
...
...
    <Modal
		open={open}
		closeModal={onClose}
	>
		<h1>Modal Content</h1>
	</Modal>

Props

Prop NameDescriptionRequiredTypeDefault Value
openIndicates if the modal is open or nottruebooleanundefined
closeModalFunction called when modal should be closedtruebooleanundefined
closeOnEscIndicates if modal should be closed when esc is pressedfalsebooleantrue
closeOnClickOutsideIndicates if modal should be closed when clicked outside of modal contentfalsebooleantrue
modalClassNameClassName to manipulate modal stylefalsestringsimple-react-modal
modalStyleObject containing css style of modalfalseobject{}
backgroundClassNameClassName to manipulate background stylefalsestringsimple-react-modal-background
backgroundStyleObject containing css style of backgroundfalseobject{}
hasBackgroundIndicates if contains a background behind modalfalsebooleantrue

Default CSS Style

.simple-react-modal {
	width:  fit-content;
	height:  fit-content;
	background:  white;
	position:  fixed;
	left:  50%;
	top:  50%;
	transform:  translate(-50%, -50%);
	z-index:  2;
	border-radius:  5px;
}
	
.simple-react-modal-background {
	width:  100vw;
	height:  100vh;
	z-index:  1;
	background:  rgba(190, 195, 204, 0.5);
	position:  fixed;
	top:  0; right:  0; bottom:  0; left:  0;
}

Contribute:

https://github.com/VitorSFranca/simple-react-modal

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago