Skip to content

kenepa/multi-widget

2.x
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

Multi Widget

filament-multi-widget-art

Latest Version on Packagist Total Downloads

Filament Multi Widget adds a new type of widget to your Filament application. The Multi Widget allows you to combine multiple widgets into a single widget, that can be switched using tabs. This plugin helps clean up your Filament dashboard.

filament-multi-widget-art

Installation

You can install the package via composer:

Plugin Version Filament Version PHP Version
1.x 2.x > 8.0
2.x 3.x > 8.1
composer require kenepa/multi-widget

Usage

Create a new Multi Widget by extending the Kenepa\MultiWidget\MultiWidget class.

// app/Filament/Widgets/UserMultiWidget.php

class UserMultiWidget extends MultiWidget
{
    public array $widgets = [
        MySubmittedComments::class,
        MySubmittedFeedback::class,
        MySubscriptions::class,
    ];
}

The $widgets property contains the classes of all the widgets that should be added to your Multi Widget. These are normal Filament widgets that you created.
The Multi Widget above will now render as follows:

It is advised to make the canView method return false on the widgets, so that they are not rendered twice.

Persist tabs in session

To persist the tabs in the user's session, use the shouldPersistMultiWidgetTabsInSession() method:

// app/Filament/Widgets/UserMultiWidget.php

class UserMultiWidget extends MultiWidget
{
    public array $widgets = [
        MySubmittedComments::class,
        MySubmittedFeedback::class,
        MySubscriptions::class,
    ];
    
    public function shouldPersistMultiWidgetTabsInSession(): bool
    {
        return true;
    }
}

License

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

About

A Filament widget that encloses multiple widgets.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •