Skip to content

Inertia Modal Integration

Inertia Table provides deep integration with the free Inertia Modal package. This allows you to easily open modals and slideovers from Row Links. First, you need to install the Inertia Modal package. Please follow the installation instructions in the Inertia Modal documentation.

Opening URLs in Modals

As seen in the Row Links documentation, you can call the modal() method on the Url class:

php
use InertiaUI\Table\Url;

Action::make('Edit', fn (User $user, Url $url) => $url
    ->route('users.edit', $user)
    ->modal()
);

You may tweak the modal options and configuration by either passing an array to the modal() method or by passing a ModalVisit or ModalConfig instance. The structure corresponds to the modalVisit() method of the Inertia Modal package. Here is an example of passing an array:

php
$url->route('users.edit', $user)->modal([
    'navigate' => true,
    'config' => ['slideover' => true],
]);

If you prefer to use typed objects, you can use the ModalVisit class from the Inertia Modal package:

php
use InertiaUI\Modal\ModalConfig;
use InertiaUI\Modal\ModalVisit;

$url->route('users.edit', $user)->modal(
    ModalVisit::make()
        ->navigate()
        ->config(ModalConfig::make()->slideover())
);

There's a high chance you'll only need the ModalConfig class, so you can use it directly as well:

php
use InertiaUI\Modal\ModalConfig;

$url->route('users.edit', $user)->modal(
    ModalConfig::make()->slideover()
);