Toast Notification Component - LaraCoreKit

Toast notification component using Alpine.js. Auto-dismissing popups for Laravel applications.

Toast Notification

Auto-dismissing notification toast

Preview

View Code
<div x-data="{ show: false, message: 'Changes saved successfully!' }">
    <button @click="show = true; setTimeout(() => show = false, 3000)" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
        Show Toast
    </button>
    <div x-show="show"
         x-transition:enter="transition ease-out duration-300"
         x-transition:enter-start="opacity-0 transform translate-y-2"
         x-transition:enter-end="opacity-100 transform translate-y-0"
         x-transition:leave="transition ease-in duration-200"
         x-transition:leave-start="opacity-100"
         x-transition:leave-end="opacity-0"
         class="fixed bottom-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50">
        <div class="flex items-center">
            <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path>
            </svg>
            <span x-text="message"></span>
        </div>
    </div>
</div>