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

vue-tailwind-alert-toast

v1.0.7

Published

A reusable Vue 3 + TailwindCSS alert toast component with success, warning, and danger variants

Downloads

30

Readme

Vue Tailwind Alert Toast

A lightweight, reusable Vue 3 + TailwindCSS alert toast component with success, warning, and danger variants.

✅ Works with Vue 3 ✅ Uses TailwindCSS for styling ✅ Auto-hides after a configurable duration ✅ Smooth slide-in/out animation ✅ Dismissible with a close button


🚀 Installation

Install via NPM:

npm install vue-tailwind-alert-toast

This package assumes you already have Vue 3 and TailwindCSS set up.

If you don’t have Tailwind, follow the official Tailwind setup.


🔧 Setup

1️⃣ Register the plugin globally

In your main.js (or main.ts):

import { createApp } from 'vue'
import App from './App.vue'

// Import the plugin
import AlertToastPlugin from 'vue-tailwind-alert-toast'

// Make sure Tailwind is loaded
import './index.css'

const app = createApp(App)
app.use(AlertToastPlugin)
app.mount('#app')

This registers <AlertToast /> globally.


✅ Basic Usage

Now you can use the component in any Vue template:

<template>
  <div>
    <!-- Trigger buttons -->
    <button @click="showSuccess" class="px-4 py-2 bg-green-500 text-white rounded">Show Success</button>
    <button @click="showWarning" class="px-4 py-2 bg-yellow-500 text-black rounded">Show Warning</button>
    <button @click="showDanger" class="px-4 py-2 bg-red-500 text-white rounded">Show Danger</button>

    <!-- Render alert only when visible -->
    <AlertToast
      v-if="alert.visible"
      :message="alert.message"
      :type="alert.type"
      :duration="3000"
      @close="alert.visible = false"
    />
  </div>
</template>

<script setup>
import { reactive } from 'vue'

const alert = reactive({
  visible: false,
  message: '',
  type: 'danger'
})

function showAlert(msg, type = 'danger') {
  alert.message = msg
  alert.type = type
  alert.visible = true
}

function showSuccess() {
  showAlert('✅ OTP Verified successfully!', 'success')
}

function showWarning() {
  showAlert('⚠️ Please enter all fields!', 'warning')
}

function showDanger() {
  showAlert('❌ Invalid OTP!', 'danger')
}
</script>

🎨 Props

| Prop | Type | Default | Description | | ---------- | ------ | -------- | ------------------------------------------------------- | | message | String | required | The alert text you want to display | | type | String | danger | The alert type (success, warning, danger) | | duration | Number | 5000 | Auto-hide duration in ms (set 0 to disable auto-hide) |


🎯 Behavior

Auto-hide after duration (default 5 seconds) ✅ Dismiss manually with close X button ✅ Smooth slide-in/out animation ✅ Positioned at top-right corner of the screen


🛠 TailwindCSS

This component uses TailwindCSS classes:

  • bg-green-600 for success
  • bg-yellow-500 for warning
  • bg-red-600 for danger
  • fixed top-4 right-4 px-6 py-3 rounded-md shadow-lg flex items-center

Make sure TailwindCSS is enabled in your project.


🔥 Advanced Usage

You can also import the component locally if you don’t want a global plugin:

<script setup>
import { AlertToast } from 'vue-tailwind-alert-toast'
</script>

<template>
  <AlertToast message="Hello!" type="success" />
</template>

📦 Roadmap

✅ Basic alert toast ✅ Success / Warning / Danger variants ✅ Auto-hide ✅ Manual close button

➡️ Future features (optional):

  • Toast stack (multiple alerts at once)
  • Global $toast.success('msg') API

📜 License

MIT © 2025 Your Name


💡 Example

Here’s a complete example:

<template>
  <div class="p-6 space-x-2">
    <button @click="showSuccess" class="px-4 py-2 bg-green-500 text-white rounded">Success</button>
    <button @click="showWarning" class="px-4 py-2 bg-yellow-500 text-black rounded">Warning</button>
    <button @click="showDanger" class="px-4 py-2 bg-red-500 text-white rounded">Danger</button>

    <AlertToast
      v-if="alert.visible"
      :message="alert.message"
      :type="alert.type"
      :duration="4000"
      @close="alert.visible = false"
    />
  </div>
</template>

<script setup>
import { reactive } from 'vue'

const alert = reactive({
  visible: false,
  message: '',
  type: 'success'
})

function showAlert(msg, type) {
  alert.message = msg
  alert.type = type
  alert.visible = true
}

function showSuccess() {
  showAlert('✅ Saved successfully!', 'success')
}

function showWarning() {
  showAlert('⚠️ Something might be wrong!', 'warning')
}

function showDanger() {
  showAlert('❌ Failed to save data!', 'danger')
}
</script>

🏗 Publishing

Want to contribute?

  1. Clone the repo
  2. Make changes
  3. Run npm publish --access public