Notif Library is an Angular component that provides real-time notifications using Server-Sent Events (SSE). It is lightweight, customizable, and easy to integrate into Angular applications.
- Real-time notifications via SSE
- Configurable timeout duration
- Adjustable position for desktop and mobile
- Custom CSS class support
- Option to show/hide logos
Install the library using npm:
npm install notif-library
Add NotifLibraryModule
to your Angular module:
import { NotifLibraryModule } from 'notif-library';
@NgModule({
declarations: [...],
imports: [
NotifLibraryModule,
...
],
providers: [],
bootstrap: [...]
})
export class AppModule {}
Add the notification component in your template:
<notif-library *ngIf="isLoaded"
[timeout]="12000"
[showLogo]="false"
position="top-right"
mobilePosition="bottom"
className="notif-custom-class"
sseUrl="API_URL_HERE">
</notif-library>
Property | Type | Default | Description |
---|---|---|---|
sseUrl |
string |
'' |
URL for SSE event source |
timeout |
number |
12000 |
Notification display duration (in ms) |
showLogo |
boolean |
true |
Show/hide logo in notifications |
position |
string |
'bottom-left' |
Desktop notification position (top-left , top-right , bottom-left , bottom-right ) |
mobilePosition |
string |
'top' |
Mobile notification position (top , bottom ) |
className |
string |
'' |
Custom CSS class for styling |
You can add custom styles by specifying a className
and defining the styles in your global styles or component styles:
.notif-custom {
background-color: #333;
color: white;
}
This project is licensed under the MIT License. Feel free to use and modify it as needed.
For any issues or feature requests, open an issue on the GitHub repository or reach out to the maintainer.