Skip to main content

ToastLevel

Defines the severity level of toast notifications.

Enum values

Success
string
Success level toast. Used for positive confirmation messages.Value: 'success'
Error
string
Error level toast. Used for error messages and failures.Value: 'error'
Info
string
Info level toast. Used for informational messages.Value: 'info'
Warning
string
Warning level toast. Used for warning messages.Value: 'warning'

Source

<?php

namespace InertiaToast\Enums;

enum ToastLevel: string
{
    case Success = 'success';
    case Error = 'error';
    case Info = 'info';
    case Warning = 'warning';
}

Usage examples

use InertiaToast\Enums\ToastLevel;
use InertiaToast\Toaster;

$toaster = new Toaster();
$toaster->add('Operation completed', ToastLevel::Success);
$toaster->add('Something went wrong', ToastLevel::Error);
The ToastLevel enum is automatically converted to lowercase string values when passed to the frontend.

ToastPosition

Defines the screen position where toast notifications appear.

Enum values

TopRight
string
Position toasts in the top right corner of the screen.Value: 'top-right'
TopLeft
string
Position toasts in the top left corner of the screen.Value: 'top-left'
TopCenter
string
Position toasts in the top center of the screen.Value: 'top-center'
BottomRight
string
Position toasts in the bottom right corner of the screen.Value: 'bottom-right'
BottomLeft
string
Position toasts in the bottom left corner of the screen.Value: 'bottom-left'
BottomCenter
string
Position toasts in the bottom center of the screen.Value: 'bottom-center'

Source

<?php

namespace InertiaToast\Enums;

enum ToastPosition: string
{
    case TopRight = 'top-right';
    case TopLeft = 'top-left';
    case TopCenter = 'top-center';
    case BottomRight = 'bottom-right';
    case BottomLeft = 'bottom-left';
    case BottomCenter = 'bottom-center';
}

Usage examples

return [
    'position' => 'top-right', // Use the enum value
];
The position value is configured in the config/inertia-toast.php file and passed to the frontend Toaster component.