Filament: Table Row Action - View Modal with Infolist

Typically, Filament modals contain a form or a message, but did you know you can also use them to display an info list? This is useful when you don't want a full-view page!

This can be achieved by adding a new Action to our table (this works in table and custom pages):

Resource

// ...
 
public static function table(Table $table): Table
{
return $table
->actions([
Tables\Actions\Action::make('View Information')
// This is the important part!
->infolist([
// Inside, we can treat this as any info list and add all the fields we want!
Section::make('Personal Information')
->schema([
TextEntry::make('first_name'),
TextEntry::make('last_name'),
])
->columns(),
Section::make('Contact Information')
->schema([
TextEntry::make('email'),
TextEntry::make('phone_number'),
])
->columns(),
Section::make('Additional Details')
->schema([
TextEntry::make('description'),
]),
Section::make('Lead and Stage Information')
->schema([
TextEntry::make('leadSource.name'),
TextEntry::make('pipelineStage.name'),
])
->columns(),
]),
]);
}
 
// ...

Our result will be a modal with details:

If you want, you can make this modal slide from the right side too:

Resource

// ...
 
public static function table(Table $table): Table
{
return $table
->actions([
Tables\Actions\Action::make('View Information')
// This is the important part!
->infolist([
// ...
])
->slideOver(),
]);
}
 
// ...

Now, once we click on the action, we will see the following:

avatar

->copyable() not work using modal method.

👍 3
avatar

Hmm, interesting! Did not think that it would impact something

avatar

The modal header title is the name of the action ('view information'). Can't find any info about changing this like normal modals, like for example to a more describing name of the record.

avatar

can be done with ->modalHeading() on Action

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 58 courses (1056 lessons, total 44 h 09 min)
  • 78 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials