A light and simple but stylizable and animated dialog box that allows you to insert any html code into its tags it has customizable cancel and accept buttons and an auto close timer.
npm install alert-lmhbash
$ npm install alert-lmh
`
or download the package from
JSDELIVR
Usage
In React...
`javascript
//...here the rest of your code
//...
import "alert-lmh";
import { useRef } from "react";
function App() {
const alertRef = useRef(null);
function handleClick() {
alertRef.current.show();
}
return (
//...here the rest of your code
Testing alert
//...here the rest of your code
);
}
export default App;
`
or
In your plain html file...
- download the package (unzip it), copy the folder to your project
- and insert the following code:
`javascript
`
$3
`HTML
`
- 'display: none' is preferable to avoid initial flickering.
- 'id' attribute is necessary in order to be called by the method show().
- By default, if a timer is not defined, it will auto close in 1500ms.
$3
`HTML
`
$3
`HTML
`
$3
`HTML
id='anotherAlert'
action-button="Ok"
action="functionName()"
cancel-button="cancel"
style='display: none'
>
This is a dialog box
`
$3
`HTML
``