PU-Toast Component

A flexible toast notification system with multiple positions and severity levels

Usage

Basic Usage

PropTypeRequiredDefaultDescription
positiontop-left | top-right | bottom-left | bottom-right | centerNotop-rightPosition of toast container
MethodParametersDescription
add{ severity: string, summary: string, detail?: string, life?: number }Adds a new toast notification
removeid: stringRemoves a specific toast
toasts-Reactive array of active toasts
  • Base styling with Tailwind:
    .pu-toast {
      @apply flex items-center justify-between p-4 gap-2;
      @apply rounded-lg shadow-md transition-all duration-300;
      @apply ease-in-out border opacity-100 transform scale-100;
    }
    
  • Severity variants:
    .pu-toast--primary {
      @apply bg-primary-light-500 text-primary-light-50 border-transparent;
    }
    
    .pu-toast--secondary {
      @apply bg-white text-primary-light-500 border-primary-light-500 border-2;
    }
    
  • Smooth enter/leave animations:
    .toast-transition-enter-active,
    .toast-transition-leave-active {
      @apply transition-all duration-300;
    }
    
    .toast-transition-enter-from {
      @apply opacity-0 transform translate-y-4;
    }
    
    .toast-transition-leave-to {
      @apply opacity-0 transform translate-y-4;
    }
    
  • Multiple display positions
  • Customizable duration
  • Interactive close button
  • Smooth transitions
  • Severity level styling
  • toastStore for state management
  • PUIcon component for icons
  • Tailwind CSS for styling
  • Vue Transition component