Download the PHP package eolica/nova-pill-filter without Composer
On this page you can find all versions of the php package eolica/nova-pill-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eolica/nova-pill-filter
More information about eolica/nova-pill-filter
Files in eolica/nova-pill-filter
Package nova-pill-filter
Short Description A simple Laravel Nova filter that renders into clickable pills
License MIT
Homepage https://github.com/Eolica-Web/nova-pill-filter
Informations about the package nova-pill-filter
A Laravel Nova filter that renders into clickable pills.
A simple Laravel Nova filter that renders into colorful clickable pills. This filter is very inspired by this other package, however we needed some extra features (like customizing the color of each pill) for client projects and that package seemed to not be maintained nor production ready, so we decided to make our own version of this filter.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
Usage
Creating the filter
You may create a new pill filter manually and extending the Eolica\NovaPillFilter\PillFilter
class:
Or, even easier, using the following artisan command:
If you want to customize the "stub" the command uses to generate the filter class, you may use the following command to publish it:
Next, we must register the filter within the filters
method of our resource:
Configuring the filter
By default multiple items can be selected, you can restrict it to a single item at time by using the single
method
Also, the filter shows by default a "Clear" button when some item is active. When clicked, deactivates all items at once. If you want to hide the button you may use the hideClearButton
method:
If you want the "Clear" button to show, you may also change the text within by using the clearLabel
method, mainly for translation purposes:
Last, you may change the displaying mode of the filter, by default it wraps to show all pills at once, however you may change it to drag mode by using the draggable
method:
Configuring the filter options
The most simple way is to return a key/value pair array, the key being the label displayed within the pill:
You may customize each pill background color, text color, background color when active and text color when active, in this case the key of each option must be the value and the label text must be within the label
key:
Applying the values to the query
The filter will send you an array
containing the values that are active.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover a security vulnerability within this package, please send an email at [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.