1.0.1 • Published 6 months ago

modal-library-lfmi v1.0.1

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

modal-library

This is a customizable React modal

Installation

To install, you can use npm or yarn:

$ npm install modal-library-lfmi
$ yarn add modal-library-lfmi

Example

import React, { useState } from 'react';
import ConfirmationModal from 'modal-library-lfmi';
import close from '../assets/img/close.png';
import user from '../assets/img/user.png';

function App() {
  const [modalState, setModalState] = useState(false);
  const handleOpen = () => {
    setModalState(true);
  };
  const handleClose = (e) => {
    e.preventDefault();
    setModalState(false);
  };
  const handleSubmit = (e) => {
    e.preventDefault();
    handleOpen();
  };

  return (
    <ConfirmationModal
      show={modalState}
      defaultStyle={true}
      closeModal={handleClose}
      iconClose={close}
      title='Confirmation'
      hideTitle={false}
      icon={user}
      hideIcon={false}
      text='Confirmation message'
      hideText={false}
    />
  );
}

Modal example

Props

NameTypeDescription
showBooleandisplay modal or not
defaultStyleBooleanuse the default styling or not
closeModalFunctionhandle modal closing
iconCloseStringimage for the close button
titleStringdefine the modal title
hideTitleBooleandisplay modal title or not
iconStringdefine the modal icon
hideIconBooleandisplay modal icon or not
textStringdefine the modal text
hideTextBooleandisplay modal text
1.0.1

6 months ago

1.0.0

6 months ago

0.3.0

7 months ago

0.2.0

7 months ago

0.3.2

7 months ago

0.3.1

7 months ago

0.3.3

7 months ago

0.1.0

8 months ago