> For the complete documentation index, see [llms.txt](https://queents.gitbook.io/vilt/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://queents.gitbook.io/vilt/generate/modal.md).

# Modal

<figure><img src="https://598543987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3nnlrjn6TtcCpL6SXFhI%2Fuploads%2FitSu6kfFefxMeTrZ6vuM%2FScreenshot%202022-10-31%20at%2012.52.18%20PM.png?alt=media&amp;token=144a9bda-1541-488d-81f8-8055ecf44c7a" alt=""><figcaption></figcaption></figure>

it's easy to create a new custom modal on the resource and fire it using `Action::class` by set it `->modal(modal_name)` so on the action click it will open the modal

### Using

to create a new modal inside your resource class you can use this command

```php
php artisan vilt:modal
```

It will ask you to input modal name and the resource class name and the module name and it will generate an action class for you like this

```php
class CustomModal extends Modals
{
    public function setup(): void
    {
        $this->name("custom");
        $this->label(__('Custom'));
        $this->rows([
           Text::make('name')
        ]);
        $this->buttons([
           Action::make('save')->label(__('Save'))->icon('bx bxs-save')->action('custom.save')
        ]);
    }
}
```

set your data and define the modal class on `ResourceName/Components.php` trait like this

```php
public function components(): array {
  return [
     Component::make(CustomModal::class)->modal()
  ];
} 
```

you will get a modal inside your resource
