0.1.7 • Published 2 years ago
@dvor77/cpmodal v0.1.7
Introduction
This is a simple react modal
Installation
To install, you can use npm:
$ npm i @dvor77/cpmodal
Examples
Here is a simple example of react modal being used in an app with some custom styles and focusable input elements within the modal content:
import React from 'react';
import MyModal from '@dvor77/cpmodal';
import { useState } from 'react';
function YourComponent() {
const [opened, setOpened] = useState(false);
const title = "Congratulations" // Write your own title
const subtitle = "The form is registered" // Write your own subtitle
// add this function inside your react component to manage the closing of component
function closeModal() {
setOpened(false)
}
return (
<div>
<MyModal opened={opened} closeModal={closeModal} title={title} subtitle={subtitle}/>
</div>
);
}
export default YourComponent;