1.0.3 • Published 3 years ago

react-gold-modal v1.0.3

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

react-gold-modal

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-gold-modal

Usage

import React, { Component } from 'react'

import Modal from 'react-gold-modal'
import 'react-gold-modal/src/styles.scss'

const App = () => {
	const [openModal, setOpenModal] = useState(false);

 
		return <>
			<Modal
				display={openModal}
				title={'This is a modal'}
				description={'Click OK to close'}
				cancel={{
					text: 'OK',
					handler: () => setOpenModal(false),
				}}
			/>
		</>
}

Required Props

Prop NameTypeDescription
displaybool (Default false)Shows or hides the modal
canceloption objectThe object for closing the modal

Optional Props

Prop NameTypeDescription
optionsList of option objectThe object for closing the modal
classNamestrAny class to be added to all the options buttons (used for styling)
overlayIsCancelboolIf true, clicking the overlay will call the Cancel handler
isVerticalbool (Default false)If true, the options will be placed vertically
titlestrTitle text for the modal
descriptionstrDescription text for the modal
bodyanyThe body content for the modal
isLoadingbool (Default false)If true, the body and actions will be replaced with a loading state
loadingContentobjContent for the modal loading state

Option object

option = {
	text: 'Yes', 
	handler: () => setModalOpen(false), 
	className: ''
};

License

MIT © lalodoble