1.2.3 • Published 6 years ago

easy-modal-react v1.2.3

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

Easy Modal for React

An simple, clean, and easy to use modal that supports any screen size and uses (mostly) modern CSS.

Modal preview

Installation

npm install easy-modal-react

Usage

Simple

import EasyModal from 'easy-modal-react';

<EasyModal
	open={this.state.modalOpen}
	onClose={this.closeModal}
>
	content here!
</EasyModal>

Advanced

import EasyModal, { EasyModalHeader, EasyModalFooter } from 'easy-modal-react';

<EasyModal
	open={this.state.modalOpen}
	onClose={this.closeModal}
	header={<EasyModalHeader onClose={this.onClose} />}
	footer={<EasyModalFooter onCancel={this.onClose} onApprove={this.onApprove} />}
>
	content here!
</EasyModal>

<EasyModal /> Props

PropPropTypeDescription
open (required)PropTypes.boolTells EasyModal weather it is open or closedOptions: true | false
onClose (required)PropTypes.funcCalled by EasyModal when the user clicks outside the modal or hits the ESC key. Should update state for open
children (required)PropTypes.nodeThe content of the modal
classNamePropTypes.stringAdds a CSS class of your choice to the .modal-message element.
headerPropTypes.nodePropTypes.stringA React node or a string to display at the top of the modal.Use EasyModalHeader for a default header with a close button.
footerPropTypes.nodePropTypes.stringA React node or a string to display at the bottom of the modal.Use EasyModalFooter for a default footer with "Cancel" and "Ok" buttons.

<EasyModalHeader /> Props

PropPropTypeDescription
onClose (required)PropTypes.funcCalled by EasyModal when the user clicks the close button. Should update state for open

<EasyModalFooter /> Props

PropPropTypeDescription
onCancel (required)PropTypes.funcCalled by EasyModal when the user clicks the "Cancel" button. Should update state for open
onApprove (required)PropTypes.funcCalled by EasyModal when the user clicks the "Ok" button. Should update state for open

Browser Support

Tested in all modern browsers as well as IE11.

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

1.0.0

6 years ago