Skip to main content
Tutorial Free

Filament: Table Row Action - View Modal with Infolist

November 17, 2023
2 min read

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:

Enjoyed This Tutorial?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Comments & Discussion

KI
Khairul Imran ✓ Link copied!

->copyable() not work using modal method.

M
Modestas ✓ Link copied!

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

G
Groovix ✓ Link copied!

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.

G
Groovix ✓ Link copied!

can be done with ->modalHeading() on Action

S
szopenek17 ✓ Link copied!

Hi, Thank You! How can one populate this infolist with RepeatableEntry using data from array (like external api response) ?

S
szopenek17 ✓ Link copied!

ok, this works:

Tables\Actions\Action::make('Adresy') ->modalFooterActions(fn() => [])->hiddenLabel()->tooltip('Adres dostawy')->icon('heroicon-o-map-pin')->infolist( function (?Model $record, Infolist $infolist) { $addresses = [ 0 => ['default' => 1, 'adr_Nazwa' => 'test'] ]; return $infolist->state(['addresses' => $addresses])->schema( [ RepeatableEntry::make('addresses')->schema([ IconEntry::make('default')->boolean()->label('Domyślny'), TextEntry::make('adr_Nazwa'), ] )]);})->slideOver(),

HM
Hossam Mohamed ✓ Link copied!

How to remove the submit button from the modal ? because it doesn't make a difference

M
Modestas ✓ Link copied!

You can add this parameter:

->modalSubmitAction('')

This will remove the submit button

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.