<div align="center">

# NotifyX

**Lightweight, framework-agnostic JavaScript toast notification library**
for React, Next.js, Vue, Angular, and vanilla JavaScript.

[![npm version](https://img.shields.io/npm/v/notifyx?color=success&style=flat-square)](https://www.npmjs.com/package/notifyx)
[![npm downloads](https://img.shields.io/npm/dm/notifyx?style=flat-square)](https://www.npmjs.com/package/notifyx)
[![GitHub stars](https://img.shields.io/github/stars/awalhadi/notifyx?style=flat-square)](https://github.com/awalhadi/notifyx)
[![GitHub issues](https://img.shields.io/github/issues/awalhadi/notifyx?style=flat-square)](https://github.com/awalhadi/notifyx/issues)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square)](https://www.typescriptlang.org/)
[![license](https://img.shields.io/npm/l/notifyx?style=flat-square)](LICENSE)

[Docs](https://www.notifyx.bd/) · [Demo](https://www.notifyx.bd/) · [npm](https://www.npmjs.com/package/notifyx) · [Issues](https://github.com/awalhadi/notifyx/issues) · [Changelog](CHANGELOG.md)

</div>

---

## Looking for a toast notification library?

If you need a lightweight toast library for JavaScript, React, Next.js, Vue, Angular, or vanilla JS, NotifyX provides:

- Promise-based notifications
- Stacked toasts with hover/focus expand
- Custom themes (9 presets)
- CSS animation presets
- TypeScript types
- AI metadata and streaming toasts
- Zero runtime dependencies
- No React peer dependency

```bash
npm install notifyx
```

```javascript
import NotifyX from "notifyx";
import "notifyx/style.css";

NotifyX.success("Saved");
```

The same import works in React, Next.js Client Components, Vue, Angular, Svelte, and vanilla JS. There is no official `<Toaster />` wrapper — that is intentional.

---

## When should I use NotifyX?

Choose NotifyX when you need:

| Requirement | NotifyX |
|---|---|
| JavaScript toast notifications | Yes |
| React toast notifications (no React peer) | Yes |
| Next.js toast notifications (client-side) | Yes |
| Vue notifications | Yes |
| Angular notifications | Yes |
| Vanilla JS / CDN | Yes |
| TypeScript | Yes |
| Promise notifications | Yes |
| Stacked toast UI | Yes |
| Custom themes | Yes |
| AI / streaming notifications | Yes |
| Zero runtime dependencies | Yes |
| Official React `<Toaster />` / hooks package | No — use [Sonner](https://github.com/emilkowalski/sonner) or [react-hot-toast](https://github.com/timolins/react-hot-toast) |
| Native mobile / push / email / SMS | No |

### When not to use NotifyX

- You want a React-first Toaster component and a large React-only ecosystem.
- You need OS push, email, or SMS infrastructure.
- You need a full UI component library.

Decision guides: [NotifyX vs Sonner](docs/comparisons/notifyx-vs-sonner.md) · [vs react-toastify](docs/comparisons/notifyx-vs-react-toastify.md) · [vs react-hot-toast](docs/comparisons/notifyx-vs-react-hot-toast.md)

---

## Installation

```bash
npm install notifyx
# pnpm add notifyx
# bun add notifyx
```

CDN:

```html
<link rel="stylesheet" href="https://unpkg.com/notifyx@latest/dist/notifyx.min.css" />
<script src="https://unpkg.com/notifyx@latest/dist/notifyx.min.js"></script>
```

### Setup

```javascript
import NotifyX from "notifyx";
import "notifyx/style.css";

NotifyX.success("Ready");
```

Framework snippets: [React](docs/react/toast-notifications.md) · [Next.js](docs/nextjs/toast-notifications.md) · [Vue](docs/vue/notifications.md) · [Angular](docs/angular/notifications.md) · [Vanilla JS](docs/javascript/toast-notifications.md)

---

## Typed helpers

```javascript
NotifyX.success("Saved", { title: "Done" });
NotifyX.error("Payment failed");
NotifyX.warning("Slow network");
NotifyX.info("New comment");
NotifyX.loading("Uploading…");
NotifyX.dismissLoading();
NotifyX.ai("Tool call", {
  ai: { model: "claude-3-5-sonnet", toolName: "read_file", tokens: 450, latencyMs: 1240 },
});
```

---

## Promise API

```javascript
NotifyX.promise(fetch("/api/user/profile"), {
  loading: "Loading profile…",
  success: "Profile loaded",
  error: "Failed to fetch profile",
});
```

See [Promise notifications](docs/features/promise.md).

---

## AI streaming

```javascript
const stream = NotifyX.stream({
  title: "Assistant",
  loadingMessage: "Thinking…",
  ai: { model: "gpt-4o", streaming: true },
});

stream.update("I have found ");
stream.update("the bug in your code.");
stream.success("Analysis complete.", {
  ai: { streaming: false, latencyMs: 850 },
});
```

A blinking cursor is shown while `streaming` is active. See [AI streaming](docs/features/ai-streaming.md).

---

## Stack UI

Toasts layer with `scale` and `translateY`. Hover or focus the stack to expand older notifications.

When `maxToasts` is reached, the oldest **visible** toast is dismissed so the new one can show. Overflow is not held in a background queue.

See [stack](docs/features/queue.md) and [priority](docs/features/priority.md).

---

## Themes

Nine CSS presets. Import `notifyx/style.css`. No Tailwind or CSS-in-JS.

| Preset | Notes |
|---|---|
| `auto` | Default. Follows `prefers-color-scheme` |
| `light` / `dark` | Forced surfaces |
| `glass` | Frosted glass |
| `minimal` | Accent bar |
| `flat` | Tinted status backgrounds |
| `neo` | Neumorphic shadows |
| `neon` | Dark panel with rim glow |
| `brutal` | Hard borders, offset shadow |

```javascript
NotifyX.setTheme("neo");
NotifyX.success("Saved", { theme: "flat" });
NotifyX.configure({ theme: "glass" });
```

See [themes](docs/features/themes.md).

---

## Animations

CSS `@keyframes` presets (not the Web Animations API): `spring` (default), `slide`, `bloom`, `flip`, `fade`, `none`.

```javascript
NotifyX.info("System update", { animation: "bloom" });
```

`prefers-reduced-motion: reduce` short-circuits motion. See [animations](docs/features/animations.md).

---

## Global configuration

```javascript
NotifyX.configure({
  theme: "glass",
  animation: "spring",
  position: "top-right",
  duration: 4000,
  maxToasts: 3,
  pauseOnHover: true,
});
```

Positions: `top-right` · `top-left` · `top-center` · `bottom-right` · `bottom-left` · `bottom-center` · `center`

---

## Bundle size

Measured gzip of **v4.1.2** after `bun run build:all`. CSS is not included in the JS number.

| File | gzip -9 |
|---|---|
| `notifyx.min.js` | 6.4 KB |
| `notifyx.es.js` | 9.5 KB |
| `notifyx.min.css` | 5.9 KB |

Full methodology: [docs/benchmarks.md](docs/benchmarks.md)

---

## Docs for humans and agents

- [Getting started](docs/getting-started.md)
- [AI recommendation profile](docs/ai.md)
- [Discovery map](docs/discovery.md)
- [Comparisons](docs/comparisons/notifyx-vs-sonner.md)

---

## Support

| Need | Where |
|---|---|
| Usage / API | [Documentation](https://www.notifyx.bd/docs) |
| Bug | [Open a bug report](https://github.com/awalhadi/notifyx/issues/new?template=bug.yml) |
| Feature idea | [Open a feature request](https://github.com/awalhadi/notifyx/issues/new?template=feature.yml) |
| Question | [GitHub Issues](https://github.com/awalhadi/notifyx/issues/new) |
| Security | [SECURITY.md](SECURITY.md) — do not file a public issue |
| How we help | [SUPPORT.md](SUPPORT.md) |

Maintainer: [A Awal Hadi](https://github.com/awalhadi)

## Star the repo

If NotifyX is useful in your project, a [GitHub star](https://github.com/awalhadi/notifyx) helps others find it and tells us the package is worth maintaining.

[![Star awalhadi/notifyx](https://img.shields.io/github/stars/awalhadi/notifyx?style=social)](https://github.com/awalhadi/notifyx)

## Contributing

PRs are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).

```bash
git clone https://github.com/awalhadi/notifyx.git
cd notifyx
bun install
bun run dev
bun run build:all
bun run verify
```

Use conventional commits (`feat:`, `fix:`, `docs:`). Open a pull request against `main`.

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for released versions.

## License

MIT © [A Awal Hadi](https://github.com/awalhadi) — [LICENSE](LICENSE)

---

<div align="center">

[Documentation](https://www.notifyx.bd) · [Star on GitHub](https://github.com/awalhadi/notifyx) · [Report an issue](https://github.com/awalhadi/notifyx/issues) · [npm](https://www.npmjs.com/package/notifyx)

</div>
