earmsby's avatar

Changing heading for main Filament dashboard

FWIW, I tried asking AI (both Larry AI and Google) for the answer to this but the given solutions were either incomplete or just didn't work.

This seems like it should be pretty simple. On a filament 4.x dashboard I want to change the page heading () from the generic "Dashboard" to something else (in this case "Home").

Several AI models suggested to: Create a new file at app/Filament/Pages/Dashboard.php and add the following code to override the title.

But when I do that, there is now a second item in the side nav. The new one says "Home" and the original "Dashboard" is still there. The page heading is still "Dashboard."

I tried creating a file: app\Filament\Pages\Dashboard.php with this code:

namespace App\Filament\Pages;
use Filament\Pages\Dashboard as BaseDashboard;

class Dashboard extends BaseDashboard
{
    protected static ?string $title = 'Home';
    protected  ?string $heading = 'Home';
}

This renders two "home" links in the side nav that both go to the same URL and the page heading remains "Dashboard."

I really thought changing this page heading would be pretty simple given all the ways to customize Filament dashboard and their components. But I'm getting nowhere.

0 likes
5 replies
LaryAI's avatar
Level 58

Certainly! This is a common confusion with Filament 4.x. Overriding the dashboard heading isn’t immediately obvious because Filament registers its own built-in Dashboard page, and simply extending it doesn’t override the default.

The Issue

When you create your own Dashboard page in App\Filament\Pages, you end up with two Dashboard pages:

  • Filament's built-in dashboard (with the title "Dashboard")
  • Your custom dashboard page ("Home"), which appears as a second navigation item.

The Solution

To replace the default dashboard with your own and customize things like the heading/title, you need to unregister the built-in dashboard from Filament’s service provider, then register your own.

Step 1: Publish Filament Configuration (if needed)

If you haven’t already:

php artisan vendor:publish --tag=filament-config

Step 2: Register Your Own Dashboard Page

app/Filament/Pages/Dashboard.php

namespace App\Filament\Pages;

use Filament\Pages\Dashboard as BaseDashboard;

class Dashboard extends BaseDashboard
{
    protected static ?string $title = 'Home';
    protected static ?string $navigationLabel = 'Home'; // For the side nav
    protected ?string $heading = 'Home'; // For the page heading

    // Optionally set subtitle and description as well
    // protected ?string $subheading = 'Your custom subheading here';
}

Step 3: Unregister the Built-in Dashboard

Open config/filament.php. Find the 'pages' array. Explicitly define your pages, omitting the built-in dashboard:

'pages' => [
    \App\Filament\Pages\Dashboard::class,
    // other custom pages...
],

If you do not see a 'pages' section, just add it.

Step 4: Clear the Cache

Filament caches navigation—clear the cache to see your changes:

php artisan filament:cache
php artisan config:clear
php artisan route:clear
php artisan view:clear

Step 5: (Optional) Customize Navigation Group

If you want to adjust where "Home" appears in the navigation, you can use:

protected static ?string $navigationGroup = 'Main';

Summary

  • Create your own Dashboard page.
  • Register it in config/filament.php under 'pages'.
  • Remove (or don’t include) the base Filament\Pages\Dashboard from 'pages'.

References


Example Final Class

namespace App\Filament\Pages;

use Filament\Pages\Dashboard as BaseDashboard;

class Dashboard extends BaseDashboard
{
    protected static ?string $title = 'Home';
    protected static ?string $navigationLabel = 'Home';
    protected ?string $heading = 'Home';
}

And in config/filament.php:

'pages' => [
    \App\Filament\Pages\Dashboard::class,
],

This will properly change the heading and ensure there isn’t a duplicate dashboard link.

earmsby's avatar

Hmmm... that did not work. I followed all the steps exactly (including clearing the cache), but I'm still seeing both "Home" and "Dashboard" in the nav, and only "Dashboard" on the page and in the browser tab. Perhaps there's another step or a mistake somewhere?

DigitalArtisan's avatar

I use this in my custom dashboards:

    protected static ?string $navigationLabel = 'Custom Dashboard';
    
    public function getTitle(): string
    {
        return 'Custom Dashboard';
    }
DigitalArtisan's avatar

I would rename your Dashboard, as I think I know what is happening. The default dashboard is being loaded, as well as your dashboard, but they have the same name "Dashboard".

Change to the following and should work:

namespace App\Filament\Pages;
use Filament\Pages\Dashboard;

class CustomDashboard extends Dashboard
{
    protected static ?string $title = 'Custom Dashboard';
    protected  ?string $heading = 'Custom Dashboard'';
}

This could be a bug or by design, I'm not sure. If the names do not match, it appears to load the dashboard twice.

Make sure the name of your Dashboard matches the title/heading, as I have shown above with CustomDashboard => "Custom Dashboard" will only show once in the menu, and the title/heading gets changed. If no heading is set, it will default to using title.

Please or to participate in this conversation.