0.1.14 • Published 8 months ago

@stuart.roch/modal-component-library v0.1.14

Weekly downloads
-
License
-
Repository
github
Last release
8 months ago

@stuart.roch/modal-component-library

A Modal React component created as a part of a training project

Installation

Run the following command: npm install @stuart.roch/modal-component-library

How to use

In your file, add this line: import Modal from '@stuart.roch/modal-component-library'

You can use it like a standard react component et style it with styled-components or classic CSS

Options

OptionsTypeDefault ValueRequiredDescription
classNamestringnoneyesClassName of the Modal Container
modalStatelistnoneyesReact State that control the render
modalContentDivClassNamestringnonenoClassName of the Modal content container
hasCloseButtonbooleantruenoThe component has a close button included
closeButtonClassNamestringnonenoIncluded close button classname
closeButtonChildHTMLElement or React ComponentnonenoIncluded close button child
onClosefunctionclose the modalnoFunction called when you click on the close button

Modal Structure

The name of class are just examples

<div class="container">
    <div class="content-container">
        "Your Content"
        <button>Close</button>
    </div>
</div>

Example 1 : Default use

import Modal from '@stuart.roch/modal-component-library'
import { useState } from 'react'
...

const [openModal, setOpenModal] = useState(false)

<>
    <Modal 
        className='modal-wrapper'
        modalState={[openModal, setOpenModal]}
    >This is a Modal</Modal>
</>
0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

8 months ago

0.1.10

8 months ago

0.1.9

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago