1.1.0 • Published 1 year ago

sbm-modal v1.1.0

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

sbm-modal

Modal Component Library

NPM JavaScript Style Guide

Install

npm install --save sbm-modal

Usage

To use the Modal component, you need to import it and its associated styles, and then include it in your React code:

import React, {useState} from 'react';
import  {Modal} from 'sbm-modal';
import 'sbm-modal/dist/index.css';

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

  const openModal = () => {
    setIsOpen(true);
  };

  const closeModal = () => {
    setIsOpen(false);
  };

  return (
    <div>
      <button onClick={openModal}>Open Modal</button>
      <Modal
        title="My Modal"
        message="This is a modal dialog"
        buttonText="Close"
        isOpen={isOpen}
        titleStyle={{color: 'red'}}
        messageStyle={{fontStyle: 'italic'}}
        modalStyle={{backgroundColor: 'gray', width : '250px' }}
        onClose={closeModal}
      />
    </div>
  );
};

Props (Properties) :

Prop NameTypeRequiredDefault ValueDescription
titlestringYes-The title of the modal
messagestringYes-The message/body of the modal
buttonTextstringYes-The text of the button that closes the modal
isOpenbooleanYes-Determines whether the modal is currently open or closed
onClosefunctionYes-A callback function to be executed when the user clicks the close button or clicks outside of the modal
titleStyleobjectNo{}Additional styles to be applied to the modal title
messageStyleobjectNo{}Additional styles to be applied to the modal message/body
buttonStyleobjectNo{}Additional classes to be applied to the modal button
modalStyleobjectNo{}Additional styles to be applied to the modal container

License

MIT © saadmontreuil

1.1.0

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

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago