1.0.18 • Published 1 year ago

elishaya-react-modal-lib v1.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Modal React

elishaya-react-modal-lib is a React modal component library created to provide reusable modal component for your React projects.

Installation

You can install the library via npm:

npm install elishaya-react-modal-lib

Prerequisites

To use elishaya-react-modal-lib, you will need to have Node.js installed on your system. The minimum required version is Node.js version 12.x or higher.

This library has been developed and tested with Node.js version 20. While it should work correctly with compatible versions, compatibility with other versions of Node.js has not been formally tested.

Usage/Examples

<Modal
    isOpen={isOpen}         
    onClose={handleClose} 
    title='Modal Title' 
    message='This is a custom modal' 
    buttonMsg='Close'
    iconColor='#5c469b'
    btnTextColor='white'
    btnBgColor='#5c469b'      
    styleIcon='check'
    btnBorderRadius='50px'
    modalBorderRadius='15px'
    gapContent={10}
/>
import { useState } from 'react'
import { Modal } from 'elishaya-react-modal-lib'
function App() {
  const [isOpen, setIsOpen] = useState(false)

  const handleOpen = () => {
    setIsOpen(true)
  }

  const handleClose = () => {
    setIsOpen(false)
  }
  
  return (
    <div className='App'>
      <button onClick={handleOpen}>Open Modal</button>

      <Modal 
        isOpen={isOpen}         
        onClose={handleClose} 
        title='Modal Title' 
        message='This is a custom modal' 
        buttonMsg='Close'
        iconColor='#5c469b'
        btnTextColor='white'
        btnBgColor='#5c469b'      
        styleIcon='check'
        btnBorderRadius='50px'
        modalBorderRadius='15px'
        gapContent={10}
      />
    </div>
  )
}

export default App

Properties

PropTypeDescription
isOpenbooleanIndicates whether the modal is open or closed.
onClosefunctionCallback to close the modal component
titlestringTitle displayed in the modal header.
messagestringContent message displayed in the body of the modal.
buttonMsgstringText displayed on the modal's action button.
gapContentnumberSpace between content.
styleIconstringStyle of the icon displayed in the modal. Possible values are "check", "error", or "none".
iconColorstringColor of the icon displayed in the modal.
btnTextColorstring Text color of the modal's action button.
btnBgColorstringBackground color of the modal's action button.
btnBorderRadiusstringBorder radius of the modal's action button. Possible values are "0px", "5px", "10px", "15px", or "50px".
modalBorderRadiusstringBorder radius of the modal itself. Possible values are "0px", "5px", "10px", "15px", or "50px".

Screenshots

ModalError Modal
Modal ScreenshotError Modal Screenshot

Tech Stack

Client: React, TypeScript

Demo

View Storybook Demo

License

Distributed under MIT license.

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago