1.3.1 • Published 2 years ago

reactmodalfz v1.3.1

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

ReactModalFz

ReactModalFz is a modal library, is wrritten in Javascript. It is a minimal library without any other dependencies, while being performant and straightforward to use, requiring developers to write fewer lines of code than other form libraries.

A library of React components created using create-react-library.

Demo

Demo text

Installation

Install ReactModalFz with npm

npm install ReactModalFz

Example

import React, { useState } from 'react'
import 'ReactModalFz/dist/index.css'
import { Modal } from 'ReactModalFz'

const App = () => {
const [isOpen, setIsOpen] = useState(0)

return (
      <Modal
         isOpen={isOpen}
         onClose={setIsOpen}
         title='Modal title'
         width='600px'
         modalContent={<p>Modal content</p>}
         footerContent={
            <>
               <button className='btn-modal'>ok</button>
               <button className='btn-modal'
                  onClick={() => setIsOpen(isOpen ? 0 : 1)} >
                  close
               </button>
            </>
         }
      />
)}

Props

NameTypeRequiredDescriptionDefault value
titlestringRequiredModal title""
widthstringOptinalModal width""
onClosefunctionRequiredon click : close modal
modalContentRequiredtrueContent of the body of the modal{<p></p>}
footerContentOptionalfalsebuttons to add to the footer{<button></button>}
isOpennumberRequiredif isOpen=1 the modal is displayed

Running Tests

To run tests, run the following command

  npm run test
1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago