1.1.12 • Published 1 year ago

modal-plugin-jbdv v1.1.12

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

code-coverage

~ React modal plugin ~

A simple plugin to add a modal to your React project.

Installation

npm install modal-plugin-jbdv
yarn install modal-plugin-jbdv

Files to import

import { Modal } from "modal-plugin-jbdv/dist/index.js";

Then you can use the Modal component in your project.

<Modal></Modal>

Props

title: string
content: string
buttons: array
onClose: function
customStyle: any

title: The title of the modal

content: The content of the modal

buttons: An array of objects to add buttons to the modal

onClose: A function to execute when the modal is closed

customStyle: An object to add custom styles to the modal

Example

import React, { useState } from "react";
import { Modal } from "modal-plugin-jbdv/dist/index.js";

function App() {
const [showModal, setShowModal] = useState(false);

const handleOpenModal = () => {
    setShowModal(true);
  };

const handleCloseModal = () => {
    setShowModal(false);
  };

const buttons = [
{
label: "Close",
onClick: () => handleCloseModal()
}
];

return (
  <div className="App">
    <button onClick={() => handleOpenModal()}>Open modal</button>
      <Modal
        title="Modal title"
        content="Modal content"
        buttons={buttons}
        onClose={() => handleCloseModal()}
        customStyle={{
            modal: {
            backgroundColor: "red"
            },
            button: {
            backgroundColor: "white",
            color: "red"
             }
        }}
      />
  </div>
 );
}

export default App;
1.1.12

1 year ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago