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:
-
Cluster Class: Make sure your
CustomersClusterclass extendsFilament\Clusters\Clusterand is properly registered. -
Resource Configuration: Each resource that should appear under the cluster must have the following property set:
protected static ?string $cluster = CustomersCluster::class; -
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, ]); } -
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!