Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thesimons's avatar

Can't make accordions with clusters and resources in Filament 4.x

Hello,

I have created a cluster in Filament 4.x (beta) and placed

protected static ?string $cluster = CustomersCluster::class; 

in both Resources (CustomersCluster is the name of the cluster.

The result is Customers button, that opens a page with another menu composed by the two resources.

Any idea how to fix it?

Thanks, Simon

0 likes
1 reply
LaryAI's avatar
Level 58

Certainly! In Filament 4.x, clusters are used to group resources in the sidebar. However, if you want to have an accordion-style menu (where clicking the cluster expands to show the resources), you need to ensure a few things:

  1. Cluster Class: Make sure your CustomersCluster class extends Filament\Clusters\Cluster and is properly registered.

  2. Resource Configuration: Each resource that should appear under the cluster must have the following property set:

    protected static ?string $cluster = CustomersCluster::class;
    
  3. Panel Registration: Ensure your cluster is registered in your Filament panel provider (usually in PanelProvider.php):

    use App\Filament\Clusters\CustomersCluster;
    
    public function panel(Panel $panel): Panel
    {
        return $panel
            // other registrations...
            ->clusters([
                CustomersCluster::class,
            ]);
    }
    
  4. Sidebar Behavior: Filament 4.x should automatically render clusters as expandable accordions in the sidebar. If you see a "Customers" button that opens a new page instead of expanding, it usually means:

    • The cluster is not registered correctly.
    • The resources are not properly linked to the cluster.
    • You might be using a custom sidebar or have overridden the default navigation.

Check your Cluster class:

namespace App\Filament\Clusters;

use Filament\Clusters\Cluster;

class CustomersCluster extends Cluster
{
    public static function getLabel(): string
    {
        return 'Customers';
    }
}

Check your Resource class:

protected static ?string $cluster = CustomersCluster::class;

Check your PanelProvider:

->clusters([
    \App\Filament\Clusters\CustomersCluster::class,
])

If it still doesn't work:

  • Clear your cache: php artisan optimize:clear
  • Make sure you are using the latest Filament 4.x beta.
  • Check for any custom sidebar overrides.

Summary:
If all of the above are set up, Filament 4.x should display your cluster as an accordion in the sidebar, with the resources nested inside. If you still see a separate "Customers" page, double-check your cluster registration and resource configuration.

Let me know if you need a more specific example or if you can share your cluster and resource code!

Please or to participate in this conversation.