logo
v2.5.12

Notification

Unlike the Alert component, the notification component is not permanently visible on the screen and is useful when you want to provide feedback to your users. The BladewindUI Notification component is solely triggered via Javascript.

To use this component simply include it anywhere on your page. If you intend to use this throughout your app it will be best to include the component in say your header page.

        
            <x-bladewind::notification />
        
    

Now you can trigger a notification using the javascript helper function. The function accepts four parameters listed below.

        
            <script>
                showNotification(title, message, type, dismiss_in);
            </script>
        
    
Parameter Required? Description
title optional Title of the notification. This should usually be very brief
message required Meesage to display to the user in the body of the notification. This can either be brief or descriptive.
type optional Type of notification to be displayed. Default is success. Available values are success info warning error. The type determines the color of the notification and the icon to be displayed.
dismiss_in optional Numeric. In how many seconds should the notification be dismissed if the user does not explicitly click on the close button. Default is 15 seconds. Note the value is in seconds and not milliseconds. So 20 will mean 20 seconds.
        
            <script>
                showNotification('Delete Successful', 'Your file was deleted successfully');
            </script>
        
    


     

        
            <x-bladewind.button
                onclick="showNotification(
                    'Download Successful',
                    'Your download completed successfully')">
                success
            </x-bladewind.button>  

            <x-bladewind.button
                onclick="showNotification(
                    'Delete Failed',
                    'Your message could not be deleted. Try again',
                    'error')">
                error
            </x-bladewind.button>  

            <x-bladewind.button
                onclick="showNotification(
                    'Low Disk Space',
                    `You have used 20gb of your 25gb storage space. <a href='#'>Upgrade soon</a>`,
                    'warning')">
                warning
            </x-bladewind.button>  

            <x-bladewind.button
                onclick="showNotification(
                    'Invitation Accepted',
                    `Samuel just accepted your invitation to join BladewindUI Inc. <a href='#'>Say Hello</a>`,
                    'info')">
                info
            </x-bladewind.button>
        
    

Multiple notifications can be triggered. In this case, they are displayed as a stack in chronological order. The latest notification is always on top.

Full List Of Attributes

The table below shows a comprehensive list of all the attributes available for the Notification component.

IMPORTANT: Projects running Laravel 8 please read this

Option Default Available Values
postion top right Defines where the notification should be displayed. Available values are top right bottom right top left bottom left

Notification with all attributes defined

        
            <x-bladewind::notification position="top right" />
        
    
The source file for this component is available in resources > views > components > bladewind > notification.blade.php