npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hamzaashraflib/easytoast

v1.0.1

Published

Angular toast popup library

Readme

Easytoast Angular Library

A reusable, responsive Angular 18 toast component for displaying success, warning, and error modals with customizable messages, titles, and actions. Supports both LTR and RTL layouts.

Features

  • Standalone Angular 18 component for easy integration.
  • Three toast types: Success, Warning, Error.
  • Responsive design for mobile, tablet, and desktop.
  • RTL support for right-to-left languages.
  • Customizable action buttons (OK and Close) with event emitters.
  • Lightweight and tree-shakable.

Installation

Install the library via npm:

npm install @hamzaashraflib/easytoast

Usage

Prerequisites

  • Angular 18 or later.
  • Node.js and npm installed.

Step 1: Import the Component

The EasytoastComponent is a standalone component, making it easy to use in Angular 18 projects. You can use it in both standalone and module-based applications.

Standalone Application

In your component (e.g., app.component.ts), import EasytoastComponent and add it to the imports array:

import { Component } from '@angular/core';
import { EasytoastComponent } from '@hamzaashraflib/easytoast';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [EasytoastComponent],
  template: `
    <lib-easytoast
      message="Operation completed successfully!"
      title="Success"
      type="success"
      [isRtl]="false"
      okActionText="OK"
      closeActionText="Close"
      (okAction)="onOk()"
      (closeAction)="onClose()"
    ></lib-easytoast>
  `
})
export class AppComponent {
  onOk() {
    console.log('OK button clicked!');
  }

  onClose() {
    console.log('Close button clicked!');
  }
}

Step 2: Configure the Toast

The EasytoastComponent supports several inputs and outputs for customization.

Inputs

| Input | Type | Description | Example Value | | --- | --- | --- | --- | | message | string | The main message to display. | "Operation completed!" | | title | string | The title of the toast. | "Success" | | type | 'success' | 'warning' | 'error' | The type of toast (affects styling). | "warning" | | isRtl | boolean | Enables right-to-left layout. | true | | okActionText | string | Text for the OK button (optional). | "Confirm" | | closeActionText | string | Text for the Close button (optional). | "Dismiss" |

Outputs

| Output | Description | Example Usage | | --- | --- | --- | | okAction | Emitted when the OK button is clicked. | (okAction)="onOk()" | | closeAction | Emitted when the Close button is clicked. | (closeAction)="onClose()" |

Step 3: Dynamic Example

Here’s an example of using EasytoastComponent dynamically to show different toast types based on user actions:

import { Component } from '@angular/core';
import { EasytoastComponent } from '@hamzaashraflib/easytoast';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [EasytoastComponent],
  template: `
    <lib-easytoast
      [message]="message"
      [title]="title"
      [type]="type"
      [isRtl]="isRtl"
      [okActionText]="okActionText"
      [closeActionText]="closeActionText"
      [duration]="number"
      (okAction)="onOk()"
      (closeAction)="onClose()"
    ></lib-easytoast>
    <button (click)="showSuccess()">Show Success</button>
    <button (click)="showWarning()">Show Warning</button>
    <button (click)="showError()">Show Error</button>
  `
})
export class AppComponent {
  message = '';
  title = '';
  type: 'success' | 'warning' | 'error' = 'success';
  isRtl = false;
  okActionText = 'OK';
  closeActionText = 'Close';

  showSuccess() {
    this.message = 'Operation completed!';
    this.title = 'Success';
    this.type = 'success';
  }

  showWarning() {
    this.message = 'Something might be wrong!';
    this.title = 'Warning';
    this.type = 'warning';
  }

  showError() {
    this.message = 'An error occurred!';
    this.title = 'Error';
    this.type = 'error';
  }

  onOk() {
    console.log('OK clicked!');
  }

  onClose() {
    console.log('Close clicked!');
  }
}

Responsive Design

The EasytoastComponent is fully responsive:

  • Mobile: Adapts to 95-98% of screen width on small screens (<600px), with stacked action buttons on very small screens (<400px).
  • Tablet/Desktop: Uses a fixed max-width of 700px for larger screens.
  • RTL Support: Enable with isRtl="true" for right-to-left languages like Arabic.

Troubleshooting

  • Component Not Rendering: Ensure EasytoastComponent is imported in the imports array (standalone) or module.
  • Styles Missing: Verify that the library’s styles are included in the compiled package (node_modules/@hamzaashraflib/easytoast).
  • TypeScript Errors: Check that the library’s package.json points to the correct module paths.

Contributing

Contributions are welcome! Please submit a pull request or open an issue on the GitHub repository.

License

MIT License. See the LICENSE file for details.

Contact

For questions or support, contact Hamza Ashraf at [email protected]