Programmatic Toasts for Nuxt.js Based On Tailwind CSS

Programmatic Toast is a Vue.js toast notification component of the Nuxt.js framework, based on Tailwind CSS.

vue toast component, vue toasted example, bootstrap 4 toast notification, vue toast notification, vue 3 toast notification

How to make use of it:

Install and download:

# Yarn
$ yarn add nuxt-tailvue

# NPM
$ npm i nuxt-tailvue --save

1. Add the nuxt-tailvue module to nuxt.config.js.

{
  modules: [
    ['nuxt-tailvue', {toast: true}],
  ]
}

2. Create toast notifications as follows:

this.$toast.show({
  type: 'success',
  title: 'Toast Title',
  message: 'Toast Message'
})

3. All possible props.

title: {
  type: [Boolean, String],
  required: false,
  default: false,
},
message: {
  type: String,
  required: false,
  default: 'Please specify a <b>message</b>',
},
type: {
  type: String,
  required: false,
  validate: (type) => { return ['success', 'info', 'danger', 'warning'].includes(type) },
  default: '',
},
icon: {
  type: [Boolean, String],
  required: false,
  default: false,
},
iconPrimary: {
  type: String,
  required: false,
  default: '',
},
iconSecondary: {
  type: String,
  required: false,
  default: '',
},
timeout: {
  type: [Boolean, Number],
  required: false,
  default: 2,
},
primary: {
  type: [Boolean, Object],
  required: false,
  default: false,
},
secondary: {
  type: [Boolean, Object],
  required: false,
  default: false,
},
classToast: {
  type: String,
  required: false,
  default: 'bg-white',
},
classTitle: {
  type: String,
  required: false,
  default: 'text-gray-900',
},
classMessage: {
  type: String,
  required: false,
  default: 'text-gray-500',
},
classClose: {
  type: String,
  required: false,
  default: 'text-gray-400',
},
classTimeout: {
  type: String,
  required: false,
  default: 'bg-gray-200',
},
defaults: {
  type: Object,
  required: false,
  default: () => ({}),
},

Options

title

  • Optional, Default: false

message

  • Required, Default: Please specify a message

type

  • Optional, Default: false
  • Acceptable: success, info, danger, warning

timeout

  • Allow the toast to timeout in second(s)
  • Displays a timeout progress bar
  • Optional, Default: 2

progress

  • Optional, Default: true
  • Control if the progress line appears

primary

  • Provide a label and callback for a primary button
  • Optional, Object,
  • ex: { label: 'UNDO', action: () => alert('primary') }

secondary

  • Provide a label and callback for a secondary button
  • Optional, Object,
  • ex: { label: 'UNDO', action: () => alert('secondary') }

classToastclassTitleclassMessageclassCloseclassTimeout

  • Optional, defaulting to white and grays
  • Specify any tailwind classes you’d like to combine

classPrimary

  • Optional, override the primary button for multiple action toasts
  • default: ‘text-indigo-600 hover:text-indigo-500 focus:shadow-outline-blue focus:border-blue-300 active:text-indigo-700 active:bg-gray-50’

classSecondary

  • Optional, override the secondary button for multiple action toasts
  • default: ‘text-gray-700 hover:text-gray-500 focus:shadow-outline-blue focus:border-blue-300 active:text-gray-800 active:bg-gray-50’,

classSingle

  • Optional, override the single button classes
  • default: ‘text-indigo-600 hover:text-indigo-500’,

Programmatic Toast Component For Nuxt.js Plugin/Github


See Demo And Download

Official Website(acidjazz): Click Here

This superior jQuery/javascript plugin is developed by acidjazz. For extra Advanced usage, please go to the official website.

Related Posts

bootstrap-dropdown-on-hover

[Animation] Bootstrap Multi-Level Responsive Dropdown Menu

Bootstrap-based multi-level dropdown navigation menu with cool animations. The dropdown on Hover is a jQuery plugin used to create Bootstrap multi-level scroll-triggered dropdown menus with CSS3 animations…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Audio-Visualizations-Wave

How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

Leave a Reply

Your email address will not be published. Required fields are marked *