Skip to content

ccsliinc/livewire-toast

Repository files navigation

An Alpine.js toast package for laravel livewire.

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published