1.1.12 • Published 4 months ago
modal-plugin-jbdv v1.1.12
~ 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
4 months ago
1.1.11
5 months ago
1.1.10
5 months ago
1.1.9
5 months ago
1.1.8
5 months ago
1.1.7
5 months ago
1.1.6
5 months ago
1.1.5
5 months ago
1.1.4
5 months ago
1.1.3
5 months ago
1.1.2
5 months ago
1.1.1
5 months ago
1.0.13
5 months ago
1.0.12
5 months ago
1.0.11
5 months ago
1.0.10
6 months ago
1.0.9
6 months ago
1.0.8
6 months ago
1.0.7
6 months ago
1.0.6
6 months ago
1.0.5
6 months ago
1.0.4
6 months ago
1.0.3
6 months ago
1.0.2
6 months ago
1.0.1
6 months ago
1.0.0
6 months ago