ccsliinc/livewire-toast

An Alpine.js toast package for laravel livewire.

v0.1 2023-03-02 14:43 UTC

This package is auto-updated.

Last update: 2024-05-30 00:54:06 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is a livewire toast package for laravel.

Installation

You can install the package via composer:

composer require ccsliinc/livewire-toast

You can publish the config file with:

php artisan vendor:publish --tag="livewire-toast-config"

This is the contents of the published config file:

return [
    /**
     *  Default delay in ms for automatic close;
     */
    'delay' => '5000',

    /**
     *  Position of toast.
     *
     * 'top-left'
     * 'top-center'
     * 'top-right'
     * 'middle-left'
     * 'middle-center'
     * 'middle-right'
     * 'bottom-left'
     * 'bottom-center'
     * 'bottom-right'
     */
    'position' => 'bottom-right',

    /**
     * Percentage
     */
    'opacity' => 85,
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="livewire-toast-views"

Usage

 1. Add @include('livewire-toast::notification') in your template.
 2. On any livewire component call:
 
    $this->notify('Message', 'Title', 'Second Title', 'type');

Arguments

  1. Message - The message to display.
  2. Title - The title of the toast.
  3. Secondary Title - Small text after the title.
  4. Toast Type - Options : success, info, error, warning

Testing

composer test

Roadmap

  • Create proper component transitions (in/out)
  • Support multiple css frameworks
  • Do Dusk testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.