earmsby's avatar

Change page title of relationship infolist

I have a relationship that has this table:

public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('note_date')
            ->defaultSort('note_date', 'desc')
            ->columns([
                TextColumn::make('note_date')
                    ->label('Date')
                    ->date(),
                TextColumn::make('note_text')
                    ->label('Note')
                    ->limit(50),
                TextColumn::make('addedBy.name')
                    ->label('Added By')
                    ->badge()
            ])
            [... snipped ...]
            ->recordActions([
                EditAction::make(),
                ViewAction::make(),
                DeleteAction::make(),
            ])
            ->toolbarActions([
                BulkActionGroup::make([
                    DeleteBulkAction::make(),
                ]),
            ]);
    }

and this infolist:

public function infolist(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextEntry::make('note_text')
                    ->label('Note')
                    ->columnSpan(2),
                TextEntry::make('note_date')
                    ->label('Date'),
                TextEntry::make('addedBy.name')
                    ->label('Added by'),
            ]);
    }

When I click on a record from the table, the title at the top of the view shows "View 2026-03-26" I realize that's correct and expected. But is there a way to omit the word "view" and just show the record title attribute itself as the page heading?

0 likes
4 replies
LaryAI's avatar
Level 58

Certainly! In Filament (which Laracasts forum questions like this usually target), when you view a record in a relation manager (using the record's Infolist), the page title is typically set automatically and built like:
View {recordTitleAttribute}

If you want just the record title attribute in the page heading (e.g., show only the date instead of "View 2026-03-26"), you have two main options:


Option 1: Override the viewLabel() method

In your Filament resource's RelationManager class, you can override the viewLabel() method to just return an empty string. This will remove the "View" prefix, and typically leave just the record title as the heading.

public static function viewLabel(): string
{
    return '';
}

If you still see a trailing space or dash, you can also try overriding the getTitle() method:

public function getTitle(): string
{
    return $this->getRecordTitle();
}

Option 2: Customize the View Page

If you need even more customization, you can publish the Filament views and adjust the view manually, but for most use cases, Option 1 above is cleanest and recommended.


Summary

In your RelationManager class, add:

public static function viewLabel(): string
{
    return '';
}

or, if needed:

public function getTitle(): string
{
    return $this->getRecordTitle();
}

Result:
Now, when viewing the record, the page heading should display just the record title attribute, e.g., "2026-03-26".


References:

Let me know if you need clarification for a specific Filament version!

Glukinho's avatar

It's getTitle() method in Filament/<...>Resource/Pages/View<...>.php:

public function getTitle(): string|Htmlable
{
    return $this->getRecord()->title;
}
earmsby's avatar

I'm not sure how that would work since this infolist is part of a Filament relationship not a resource.

earmsby's avatar
earmsby
OP
Best Answer
Level 6

Ah... easy solution:

ViewAction::make()
        ->modalHeading(''),

Adding the modalHeading() method to the ViewAction, eliminated the heading altogether which was actually what I wanted rather than "View 2026-03-26"

Please or to participate in this conversation.