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

@zogjs/toast

v0.1.2

Published

A lightweight, dependency-free toast notification plugin for Zog.js.

Readme

🍞 ZogToast

A lightweight, elegant, and fully reactive toast notification system designed specifically for Zog.js.

License Size Dependencies

✨ Features

  • Zero Dependencies: Works directly with Zog.js core.
  • Automatic Styling: Injects its own CSS—no extra files to import.
  • Positioning: 6 configurable positions (e.g., top-right, bottom-center).
  • Smart Animations: Smooth entry/exit animations based on screen position.
  • Types: Built-in support for success, error, warning, and info.
  • Global Access: Accessible via window.$toast or anywhere in your app logic.

🚀 Installation

npm install zogjs @zogjs/toast
import { use, createApp } from 'zogjs';
import { ZogToast } from '@zogjs/toast';

🛠 Usage

1. Register the Plugin

In your main application entry point (e.g., main.js), register the plugin using use(). You can pass configuration options here.

// main.js
import { createApp, use } from 'zogjs';
import { ZogToast } from '@zogjs/toast';

// Install with options
use(ZogToast, {
    position: 'top-right', // 'top-right', 'top-left', 'bottom-center', etc.
    defaultDuration: 3000  // Time in ms before auto-dismiss
});

createApp(() => {
    return {
        title: 'My Zog App'
    };
}).mount('#app');

2. Triggering Toasts

You can trigger notifications from anywhere in your application logic or directly from your HTML templates.

In JavaScript:

// Inside a function or setup block
$toast.success('Post saved successfully!');
$toast.error('Connection failed.');
$toast.warning('Battery low.');
$toast.info('New version available.');

In HTML Template:

<button @click="$toast.success('Item added to cart!')">
    Add to Cart
</button>

<button @click="$toast.error('Action denied', 5000)">
    Delete Item
</button>

⚙️ Configuration

You can pass an options object when installing the plugin:

| Option | Type | Default | Description | | :--- | :--- | :--- | :--- | | position | String | 'bottom-right' | Where toasts appear on screen. | | defaultDuration | Number | 3000 | Duration (ms) before auto-dismiss. Set to 0 to disable. |

Available Positions

  • top-right
  • top-left
  • top-center
  • bottom-right
  • bottom-left
  • bottom-center

📚 API Reference

The global $toast object provides the following methods:

$toast.success(message, [duration])

Displays a green success notification with a checkmark icon.

$toast.error(message, [duration])

Displays a red error notification.

$toast.warning(message, [duration])

Displays a yellow warning notification.

$toast.info(message, [duration])

Displays a blue informational notification.

$toast.add(message, type, [duration])

Generic method to add a toast manually.

  • type: 'success' | 'error' | 'warning' | 'info'

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.