New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bootstrap-alert

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-alert

Minimal Bootstrap 5 toast notifications

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
0
Created
Source

bootstrap-alert

npm version Bootstrap License: MIT bundle size

A lightweight Bootstrap 5 toast notification library that provides a modern alternative to alert().

Installation

To use locally, install via npm:

npm install bootstrap-alert

... and add this to your script:

import { bootstrapAlert } from "./node_modules/bootstrap-alert/dist/bootstrap-alert.js";

To use via CDN, add this to your script:

import { bootstrapAlert } from "https://cdn.jsdelivr.net/npm/bootstrap-alert@1";

Usage

import { bootstrapAlert } from "https://cdn.jsdelivr.net/npm/bootstrap-alert@1";

// Simple toast
bootstrapAlert("Simple message");

// Custom toast: with title and color
bootstrapAlert({ title: "Success", body: "Custom toast message", color: "success" });

// Replace toast: clears previous ones
bootstrapAlert({ body: "This replaces previous toast", replace: true });

// Bottom left position
bootstrapAlert({ title: "Position", body: "Bottom start", position: "bottom-0 start-0" });

// Top right position
bootstrapAlert({ title: "Position", body: "Bottom start", position: "top-0 end-0" });

// HTML toast: with icons / formatting
bootstrapAlert({ title: '<i class="bi bi-cake2"></i> Congts!', body: "Well <u>done</u>!" });

// Don't hide: Keep toast on screen until dismissed
bootstrapAlert({ body: "Stays on screen", autohide: false });

// Quick hide: Change the delay before timeout
bootstrapAlert({ body: "Vanishes quickly", delay: 500 });

API

bootstrapAlert(options) creates and displays a Bootstrap toast notification.

OptionTypeDefaultDescription
bodystringrequiredToast message text/HTML
titlestringToast header text/HTML
colorstringBootstrap color variant (primary, success, danger, warning, info)
replacebooleanfalseIf true, replaces previous toasts; else, appends toast
positionstring'top-0 end-0'Toast position {top/start/bottom/end}-{0/50/100}. Persists
delaynumber5000Delay in milliseconds before hiding the toast
autohidebooleantrueAutomatically hide the toast after the delay
animationbooleantrueApply a CSS fade transition to the toast

Throws:

  • Error if Bootstrap 5 is not loaded
  • Error if body parameter is not provided

Development

git clone https://github.com/sanand0/bootstrap-alert.git
cd bootstrap-alert

npm install
npm run lint && npm run build && npm test

npm publish
git commit . -m"$COMMIT_MSG"; git tag $VERSION; git push --follow-tags

Release notes

  • 1.1.1: 31 Jun 2025. Standardized package.json & README.md
  • 1.0.0: 25 Jun 2025. Initial release

License

MIT

Keywords

bootstrap

FAQs

Package last updated on 31 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts