oc-yoshi-modal-lib
v1.1.1
Published
Simple library to display text in a modal (part of a school project)
Downloads
4
Readme
oc-yoshi-modal-lib
React Library to add modals to your projects (part of a project for studies)
Key Features
- Easy to use: incredibly simple to setup a modal quickly
- Custom text: you can customize the text of the modal to your liking
- Custom eventHandler: you can decide what happens when the modal button is clicked to close it
Install
npm install --save oc-yoshi-modal-lib --force
Usage
import React, { useState } from 'react'
import { SimpleModal } from 'oc-yoshi-modal-lib'
import 'oc-yoshi-modal-lib/dist/index.css'
const App = () => {
const [isOpen, setIsOpen] = useState(false)
return (
<div>
<h1>Basic Page</h1>
<button onClick={() => setIsOpen(true)}>Open Modal</button>
{isOpen ? (
<SimpleModal
onClickHandler={() => setIsOpen(false)}
text='Employee Created!'
/>
) : null}
</div>
)
}
export default App
All props
| Prop | Type | Required? | Default | Description | | -------------- | -------- | ------------ | ------- | ---------------------------------------------------- | | text | string | required | false | The text you want to display | | onClickHandler | function | required | false | Event handler for modal when close button is clicked |
Credits
This software uses the following open source packages:
License
MIT © yoshi-bh