marshmallow/nova-mega-filter

Allows you to control the columns and filters shown on your nova resources.

v1.0.0 2025-05-01 10:44 UTC

This package is auto-updated.

Last update: 2025-05-01 10:46:17 UTC


README

Important

This package was originally forked from digital-creative/nova-mega-filter. Since we were making many opinionated changes, we decided to continue development in our own version rather than submitting pull requests that might not benefit all users of the original package. You’re welcome to use this package—we’re actively maintaining it. If you encounter any issues, please don’t hesitate to reach out.

Nova Mega Filter

Latest Version on Packagist Total Downloads License

Display all your filters in a card instead of a tiny dropdown!

Nova Mega Filter in Action

Installation

You can install the package via composer:

composer require marshmallow/nova-mega-filter

Basic Usage

Basic demo showing the power of this package:

use Marshmallow\MegaFilter\MegaFilter;
use Marshmallow\MegaFilter\MegaFilterTrait;

class ExampleNovaResource extends Resource {

    use MegaFilterTrait;

    public function filters(RequestRequest $request): array
    {
        return [
            MegaFilter::make([
                DateOfBirthFilter::make(),
                UserTypeFilter::make(),
            ]),
        ];
    }

}

And you are done!

You can also add other fields alongside your Mega Filters, they will be rendered as usual:

use Marshmallow\MegaFilter\MegaFilter;
use Marshmallow\MegaFilter\MegaFilterTrait;

class ExampleNovaResource extends Resource {

    use MegaFilterTrait;

    public function filters(NovaRequest $request): array
    {
        return [
            MegaFilter::make([ ... ]),

            // These will be rendered as normal on the usual tiny filter dropdown
            DateOfBirthFilter::make(),
            UserTypeFilter::make(),
        ];
    }

}

You can also set how many columns you want to display your filters:

public function filters(NovaRequest $request): array
{
    return [
        MegaFilter::make([ ... ])->columns(3),
    ];
}

By default, the filter section is collapsed. If you want it to open or expanded initially, you can do:

public function filters(NovaRequest $request): array
{
    return [
        MegaFilter::make([ ... ])->open(),
    ];
}

Note: At the moment this package only works with a single Mega Filter per resource, adding multiple on the same resource may result in unexpected behavior.

License

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