Modal-Simple
This is a simple quick and customizable modal component that you can use in your App. The modal is based on bootstrap.
Installation
npm i modal-simple react-bootstrap
and don't forget to add the bootstrap's stylesheet <link>
into your <head>
before all other stylesheets to load CSS :
Demo
If you just want to try out Modal-Simple, you can also use :
or use our :
Examples
-
Simple use
<Modal title= text: "title" bodyText="something" />
-
Simple Custom
<Modalopen=text: "Open me"className: "open"variant: "secondary"title= text: "title"closeBtn= show: false><strong>test 2</strong><ModalFooter validate= text: "Validate" variant: "primary" /></Modal>
-
Hard custom
state = show: false ;{this;};{return<div className="App"><button className="open" onClick=thismodalState>"Open"</button><Modalshow = thisstateshowonHide = thismodalStatecloseBtn = show: true className: "btn-close"className =modal: "modal-block-App"header: "header-block"body: "body-block"footer: "footer-block"<ModalHeader><h1 className='title'>Hard Custom</h1></ModalHeader><ModalBody><div className="d-flex flex-row body-block"><img src=logo alt="logo"/><img src=logo alt="logo"/>test</div></ModalBody><ModalFootervalidate =text: "Validate"action: thismodalStateclassName: "btn-valid"cancel =text: "Close"action: thismodalStateclassName: "btn-cancel"/></Modal></div>}
API
Modal
Name | Type | Default | Description |
---|---|---|---|
show | boolean | false | When true the modal will show itself. |
onHide | function | A callback fired when the header closeButton or non-static backdrop is clicked. Required if either specified. |
|
title | object | text: string className: string |
Specify the header title and className. |
closeBtn | object | show : Boolean className : string |
Specify if you need the close button appear and apply a class. |
className | object | modal: string header: string body: string footer: string |
Add a className to each part to be able to custom them. |
footer | boolean | true | if you don't want the block footer appear set it to false. |
open | object | text: string className: string variant: string |
You can custom the provide button by your own text and style. |
Modal.Footer
Name | Type | Default | Description |
---|---|---|---|
validate | object | text: string action: function className:string variant:string |
You can custom the provide button by your own text and style. |
cancel | object | text: string action: function className:string variant:string |
You can custom the provide button by your own text and style. |