ToastNotificationJs 1.0.1
See the version list below for details.
dotnet add package ToastNotificationJs --version 1.0.1
NuGet\Install-Package ToastNotificationJs -Version 1.0.1
<PackageReference Include="ToastNotificationJs" Version="1.0.1" />
<PackageVersion Include="ToastNotificationJs" Version="1.0.1" />
<PackageReference Include="ToastNotificationJs" />
paket add ToastNotificationJs --version 1.0.1
#r "nuget: ToastNotificationJs, 1.0.1"
#addin nuget:?package=ToastNotificationJs&version=1.0.1
#tool nuget:?package=ToastNotificationJs&version=1.0.1
ToastNotificationJs
A reusable toast notification component for ASP.NET Core and Classic ASP.NET MVC projects, designed to show beautiful, customizable notifications with simple JavaScript and CSS.
Features
- Display toast notifications at any screen position (bottom-center by default).
- Multiple types of notifications: success, error, info, warning, or custom colors.
- Smooth slide-in/out animations from different directions.
- Progress bar with timeout countdown.
- Close button to manually dismiss notifications.
- Compatible with both ASP.NET Core and classic MVC projects.
- Easy to integrate with minimal setup.
Installation
You can install via NuGet package manager:
Install-Package ToastNotificationJs
Or download the source from GitHub repository.
Usage
For ASP.NET Core
- Include CSS and JS files from
wwwroot/toastnotification/
in your layout:
<link rel="stylesheet" href="~/toastnotification/ToastNotification.css" />
<script src="~/toastnotification/ToastNotification.js"></script>
- Add a container div anywhere in your layout or page:
<div id="toastContainer" class="toast-container"></div>
- Call the
showToast
JavaScript function to display notifications:
showToast('Hello from ASP.NET Core!', 'success', 'Success', 4000);
For Classic ASP.NET MVC
- Reference CSS and JS files from the
content/toastnotification/
folder in your_Layout.cshtml
:
<link href="@Url.Content("~/content/toastnotification/ToastNotification.css")" rel="stylesheet" />
<script src="@Url.Content("~/content/toastnotification/ToastNotification.js")"></script>
- Add the container div:
<div id="toastContainer" class="toast-container"></div>
- Use
showToast
as above. A reusable toast notification component for ASP.NET Core and Classic ASP.NET MVC projects, designed to show beautiful, customizable notifications with simple JavaScript and CSS.
Features
- Display toast notifications at any screen position (bottom-center by default).
- Multiple types of notifications: success, error, info, warning, or custom colors.
- Smooth slide-in/out animations from different directions.
- Progress bar with timeout countdown.
- Close button to manually dismiss notifications.
- Compatible with both ASP.NET Core and classic MVC projects.
- Easy to integrate with minimal setup.
Installation
You can install via NuGet package manager:
Install-Package ToastNotificationJs
Or download the source from GitHub repository.
Usage
For ASP.NET Core
- Include CSS and JS files from
wwwroot/toastnotification/
in your layout:
<link rel="stylesheet" href="~/toastnotification/ToastNotification.css" />
<script src="~/toastnotification/ToastNotification.js"></script>
- Add a container div anywhere in your layout or page:
<div id="toastContainer" class="toast-container"></div>
- Call the
showToast
JavaScript function to display notifications:
showToast('Hello from ASP.NET Core!', 'success', 'Success', 4000);
For Classic ASP.NET MVC
- Reference CSS and JS files from the
content/toastnotification/
folder in your_Layout.cshtml
:
<link href="@Url.Content("~/content/toastnotification/ToastNotification.css")" rel="stylesheet" />
<script src="@Url.Content("~/content/toastnotification/ToastNotification.js")"></script>
- Add the container div:
<div id="toastContainer" class="toast-container"></div>
- Use
showToast
as above.
API
showToast(message, color = 'info', title = null, duration = 5000, position = 'bottom-center')
message
(string): Text to show.color
(string): One of'success'
,'error'
,'info'
,'warning'
, or any valid CSS color.title
(string | null): Optional title text.duration
(number): Duration in milliseconds before toast auto hides.position
(string): Position on screen. Options:'bottom-center'
(default)'bottom-left'
'bottom-right'
'top-center'
'top-left'
'top-right'
Demo
Check the live demo for examples.
License
MIT License © 2025 Kaveh Norozi
راهنمای استفاده (فارسی)
ToastNotificationJs یک کامپوننت اعلان توست قابل استفاده مجدد برای پروژههای ASP.NET Core و MVC کلاسیک است.
امکانات
- نمایش اعلانها در هر جای صفحه با حالت پیشفرض پایین وسط.
- انواع اعلانها: موفقیت، خطا، اطلاع، هشدار یا رنگ دلخواه.
- انیمیشن روان ورود و خروج اعلانها.
- نوار پیشرفت زمانبندی.
- دکمه بستن دستی اعلان.
- سازگار با ASP.NET Core و MVC کلاسیک.
- راهاندازی سریع و آسان.
نصب
با استفاده از NuGet:
Install-Package ToastNotificationJs
یا از گیتهاب دانلود کنید:
https://github.com/kavehnorozi/ToastNotificationJs
استفاده
در ASP.NET Core
- لینک کردن CSS و JS:
<link rel="stylesheet" href="~/toastnotification/ToastNotification.css" />
<script src="~/toastnotification/ToastNotification.js"></script>
- اضافه کردن کانتینر:
<div id="toastContainer" class="toast-container"></div>
- استفاده از تابع جاوااسکریپت:
showToast('سلام از ASP.NET Core!', 'success', 'موفقیت', 4000);
در MVC کلاسیک
- اضافه کردن فایلها در
_Layout.cshtml
:
<link href="@Url.Content("~/content/toastnotification/ToastNotification.css")" rel="stylesheet" />
<script src="@Url.Content("~/content/toastnotification/ToastNotification.js")"></script>
- اضافه کردن کانتینر:
<div id="toastContainer" class="toast-container"></div>
- استفاده مانند قبل.
API فارسی
showToast(پیام, رنگ = 'info', عنوان = null, مدت = 5000, موقعیت = 'bottom-center')
پیام
: متن اعلانرنگ
: success، error، info، warning یا رنگ CSS دلخواهعنوان
: متن عنوان اختیاریمدت
: زمان به میلیثانیه برای نمایش اعلانموقعیت
: محل نمایش اعلان، گزینهها:- پایین وسط (پیشفرض)
- پایین چپ
- پایین راست
- بالا وسط
- بالا چپ
- بالا راست
تماس
برای سوالات، پیشنهادات و مشکلات به GitHub Issues مراجعه کنید.
امیدوارم این پروژه برای شما مفید باشد!
یا از گیتهاب دانلود کنید:
[https://github.com/kavehnorozi/ToastNotificationJs](https://github.com/kavehnorozi/ToastNotificationJs)
### استفاده
#### در ASP.NET Core
1. لینک کردن CSS و JS:
```html
<link rel="stylesheet" href="~/toastnotification/ToastNotification.css" />
<script src="~/toastnotification/ToastNotification.js"></script>
- اضافه کردن کانتینر:
<div id="toastContainer" class="toast-container"></div>
- استفاده از تابع جاوااسکریپت:
showToast('سلام از ASP.NET Core!', 'success', 'موفقیت', 4000);
در MVC کلاسیک
- اضافه کردن فایلها در
_Layout.cshtml
:
<link href="@Url.Content("~/content/toastnotification/ToastNotification.css")" rel="stylesheet" />
<script src="@Url.Content("~/content/toastnotification/ToastNotification.js")"></script>
- اضافه کردن کانتینر:
<div id="toastContainer" class="toast-container"></div>
- استفاده مانند قبل.
API فارسی
showToast(پیام, رنگ = 'info', عنوان = null, مدت = 5000, موقعیت = 'bottom-center')
پیام
: متن اعلانرنگ
: success، error، info، warning یا رنگ CSS دلخواهعنوان
: متن عنوان اختیاریمدت
: زمان به میلیثانیه برای نمایش اعلانموقعیت
: محل نمایش اعلان، گزینهها:- پایین وسط (پیشفرض)
- پایین چپ
- پایین راست
- بالا وسط
- بالا چپ
- بالا راست
تماس
برای سوالات، پیشنهادات و مشکلات به GitHub Issues مراجعه کنید.
امیدوارم این پروژه برای شما مفید باشد!
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release: supports both ASP.NET Core (wwwroot-based projects) and ASP.NET MVC Classic (Script and Content folders). Includes CSS animations and simple configuration.