1.5.1 • Published 4 months ago
dialog-lite v1.5.1
➤ Install
yarn add dialog-lite
➤ Import
import DialogLite from 'dialog-lite';
CSS
import 'dialog-lite/dist/index.css';
or
@import "dialog-lite/dist/index.css";
➤ Usage
const dialogLite = new DialogLite({
closingButton: true,
closingBackdrop: true,
});
dialogLite.init();
button.addEventListener('click', () => {
dialogLite.open({
stylingClass: 'dialog-lite--first-window',
});
});
➤ Options
Option | Type | Default | Description |
---|---|---|---|
closingButton | boolean | false | When set to true, enables the close button functionality in the dialog. The dialog can be closed by clicking the close button. |
closingBackdrop | boolean | false | When set to true, enables closing the dialog by clicking on the backdrop. |
➤ API
Method | Parameters | Description |
---|---|---|
init | None | Initializes the dialog, setting up event listeners for close button, backdrop click, and escape key based on the provided options. |
open | { stylingClass?: string } Default: { stylingClass: '' } | Opens the dialog, applying the specified styling class. Focuses on the first element inside the dialog with tabindex="0", and stores the previously focused element. |
close | None | Closes the dialog, restoring focus to the previously focused element. Adds the class for closing animation and optionally delays removal of the class. |
➤ Events
Method | Description |
---|---|
click (Close Button) | Triggered when the close button is clicked, closing the dialog if closingButton option is enabled. |
click (Backdrop) | Triggered when the backdrop is clicked, closing the dialog if closingBackdrop option is enabled. |
keydown (Escape key) | Triggered when the Escape key is pressed, closing the dialog. |
➤ License
dialog-lite is released under MIT license
1.5.1
4 months ago
1.5.1-dev.0
4 months ago
1.3.7
5 months ago
1.3.6
5 months ago
1.3.4
5 months ago
1.3.3
5 months ago
1.5.0
5 months ago
1.4.1
5 months ago
1.3.2
5 months ago
1.4.0
5 months ago
1.3.1
5 months ago
1.2.2
5 months ago
1.3.0
5 months ago
1.2.1
5 months ago
1.3.10
5 months ago
1.3.11
5 months ago
1.3.12
5 months ago
1.3.9
5 months ago
1.3.8
5 months ago
1.2.0
5 months ago
1.1.0
8 months ago
1.0.0
8 months ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.1-alpha.3
1 year ago
0.0.1-alpha.2
1 year ago
0.0.1-alpha.1
1 year ago