1.1.8 • Published 4 years ago

react-partial-modal v1.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

react-partial-modal


package version Provider a simple react modal component created via react partials

Setup

npm

 npm install --save react-partial-modal
and import it
import useModal from 'react-partial-modal'

Usage

import React from 'react'
import useModal from 'react-partial-modal'
const Example = () => {
    const [ModalWrapper,open,close,isOpen] = useModal('root')
    return (
        <div>
            <button onClick={open}>open Modal</button>
            <ModalWrapper>
                <div>
                    modal content
                </div>
            </ModalWrapper>
            <button onClick={close}>close Modal</button>
        </div>
    )
}

export default Example

API

const [ModalWrapper,open,close,isOpen]=useModal(element id,options)
namedescription
ModalWrapperA react modal that wraps the whole content of your modal
openfunction that opens modal(your modal is not open until you call this function
closefunction that closes the modal
isOpena boolean that is true if modal is open or false when modal is closed
optionsit's an object that has "preventScroll" key set it to true if you want to prevent scrolling when modal is open
element idthe element id that you want to create your partial in
1.1.8

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.6.0

4 years ago