Install

To install this library, you can use npm for package management, the CDN for direct inclusion, or manually download it from the GitHub releases page.

  1. Install use-bootstrap-toaster in your Node.js powered apps with the npm package:

    npm install use-bootstrap-toaster
  2. After installation, you can import the library into your project as follows:

    import toast from 'use-bootstrap-toaster'

You can use use-bootstrap-toaster directly via CDN:

<script src="https://cdn.jsdelivr.net/npm/use-bootstrap-toaster@1.0.3/dist/use-bootstrap-toaster.min.js"></script>

Example

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <title>Example</title>
  </head>
  <body>
    <div class="container pt-4">
      <button id="example" class="btn btn-primary" type="button">example</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/use-bootstrap-toaster@1.0.3/dist/use-bootstrap-toaster.min.js"></script>
    <script>
      document.getElementById('example').addEventListener('click', () => {
        toast('Hello, world! This is a toast message.')
      })
    </script>
  </body>
</html>

Visit the GitHub releases page to download the latest version