@patrik-alexits/alert-webcomponent
v1.0.7
Published
Example Web Component for an alert
Downloads
3
Maintainers
Readme
@patrik-alexits/alert-webcomponent
Experimental Hybrids.js-based Web Component for an "alert" functionality. This component allows the creation of customised alerts.
Installation
To install this component, use the following command:
npm install @patrik-alexits/alert-webcomponent
Usage
The component only works if the parent of the component in the DOM is the document.body
.
First, import the component in your JavaScript or TypeScript file:
import '@patrik-alexits/alert-webcomponent';
You can then use the component in your HTML:
<app-alert
type="warning"
text="The app is still in development, some features might not work"
dismissable="true"
duration="2000">
</app-alert>
Interface "IAlert"
The component provides the following interface for customizing its content:
- type: string: Defines the look of the component.
- text: string: The text of the component to be displayed.
- dismissable?: string | boolean: Optional. Sets the duration of the component to be displayed.
- duration?: string | number: Optional. Sets the duration of the dismissable option in milliseconds.
License
This project is ISC licensed.