Star Follow @1000ch
GitHub # x-notification ![GitHub Actions Status](https://github.com/1000ch/x-notification/workflows/test/badge.svg) Declarative Browser Notification as Web Components. ## Demo ```html This will be shown automatically. Delay is 0, timeout is 3000. ``` This will be shown automatically. Delay is 0, timeout is 3000. ## Install Using [npm](https://www.npmjs.org/package/x-notification): ```sh $ npm install x-notification ``` ## Usage Import `XNotification` and register it. ```html ``` Put `` tag. ```html Notification body ``` If you set `autoshow` attribute, a notification will be shown automatically. To show it manually, execute `show()` function. ```js document.querySelector('x-notification').show(); ``` ## Attributes ### `title=` **This is a required option** . This will be set as notification title. ### `dir=` The direction of the notification. It can be **auto** , **ltr** , or **rtl** . ### `lang=` Specify the language used within the notification. ### `body=` A string representing an extra content to display within the notification. ### `tag=` An ID for a given notification that allows to retrieve, replace or remove it if necessary. ### `icon=` The URL of an image to be used as an icon by the notification. ### `delay=` Delay for timing to show notification. ### `timeout=` Timeout for timing to close notification automatically. ### `autoshow` If you add this attribute, notification will be shown automatically. ## License [MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)