1.9.6 • Published 1 year ago

mgs-modal v1.9.6

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

react-mgs-modal

react modal componenet ready to be customized

Prerequisites

  • npm
  • react >=18.2.0
  • styled-components >=5.3.6

Installation

In you terminal enter :

npm i mgs-modal\
yarn add mgs-modal

How to use it

// import REACT
import React from 'react';
// import MODAL COMPONENT
import { Modal, useModal } from 'mgs-modal';
//-----------------------------------------------
function App() {
    const { 
        isShowing: showModal, 
        toggle: toggleModal
    } = useModal();

    // call function on OnClick of the button to display modal
    const saveOnClick = (e) => { 
        e.preventDefault();
        toggleModal()
    };

    return (
        <div>
            <button className="button" onClick={saveOnClick }> Save </button>

            <Modal
                isShowing={showModal}
                hide={toggleModal}
                text="Employee Created!"
                title="HRnet - Create Employee" 
            />
        </div>
    );
}

export default App;

Custom

Props
Prop nameDescriptionExample values
isShowingDefine display status of modalBoolean: true
hideDefine function called to turn on/off the modalFunction: toggleModal
titleContent of the titleString: HRnet - Create Employee
textContent of the bodyString: Employee Created!
primaryDefine main color scheme (header & button background)String: white / rgb(125,12,89) / #FF0000
secondaryDefine secondary color schene (button icon)String: black / rgb(105,105,105) / #FF0000
1.9.6

1 year ago

1.9.4

1 year ago

1.9.3

1 year ago

1.9.2

1 year ago

1.8.8

1 year ago

1.8.2

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

2.3.1

1 year ago

2.2.1

1 year ago

1.2.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago

1.0.0

1 year ago