amir-hossein5/laravel-components

laravel-components

v2.0.2 2021-12-08 10:16 UTC

This package is auto-updated.

Last update: 2024-06-23 17:51:14 UTC


README

This package provides ready to use pagination components using tailwindcss inside (you don't need to have it).

For example instead of :

//Controller
 $users = User::paginate(4);
//Blade
{{ $users->links() }}

You may use in blade:

<x-pagination::gray-circled :elems="$users" />

And it previews with gray-circled theme :

gray-circled-theme

But you can change themes and more settings read Usage.


Prerequisites

  • Laravel 8
  • PHP 8

Installation

composer require amir-hossein5/laravel-components

Components

Pagination

Directive:

<x-pagination::theme-name :elems="$users" 

Styles:

...
    @lComponentStyles('pagination')
</head>

All parameters of paginate tag :

parameter description default
:elems="" pagination items
prev="string" previous button's html laravel's default
next="string" next button's html laravel's default
prevInResponsive="string" previous button's html in responsive pagination laravel's default
nextInResponsive="string" next button's html in responsive pagination laravel's default
:showDisabledButtons="boolean" show disabled buttons when paginator is on first or last page depends on theme
:showPaginatorDetails="boolean" show text "Showing 4 to 6 of 12 results" or not true
class="string" class for pagination main (parent) tag

for example:

<x-pagination::light-underlined
  :elems="$users"
  :showPaginatorDetails="false"
  :showDisabledButtons="true" 
/>

Themes

Pagination

  • light

    light-theme
  • gray

    gray-theme gray-theme
  • light-circled

    light-circled-theme
  • gray-circled

    gray-circled-theme
  • light-underlined

    light-underlined-theme
  • red-pill

    red-pill-theme

Modification

To modify any component use vendor:publish --tag=componentName-themeName.
For example for pagination and theme of gray:

php artisan vendor:publish --tag=pagination-gray

License

License