diff --git a/docs-assets/app/app/Http/Livewire/Actions.php b/docs-assets/app/app/Http/Livewire/Actions.php
index 01a98751f6..00ca03b710 100644
--- a/docs-assets/app/app/Http/Livewire/Actions.php
+++ b/docs-assets/app/app/Http/Livewire/Actions.php
@@ -5,6 +5,7 @@ namespace App\Http\Livewire;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
+use Filament\Forms\Components\Select;
use Livewire\Component;
class Actions extends Component implements HasActions
@@ -70,6 +71,43 @@ class Actions extends Component implements HasActions
->action(fn () => null);
}
+ public function confirmationModalCustomTextAction(): Action
+ {
+ return Action::make('confirmationModalCustomTextAction')
+ ->label('Delete')
+ ->color('danger')
+ ->requiresConfirmation()
+ ->modalHeading('Delete post')
+ ->modalSubheading('Are you sure you\'d like to delete this post? This cannot be undone.')
+ ->modalButton('Yes, delete it')
+ ->action(fn () => null);
+ }
+
+ public function modalFormAction(): Action
+ {
+ return Action::make('modalFormAction')
+ ->label('Update author')
+ ->form([
+ Select::make('authorId')
+ ->label('Author')
+ ->required(),
+ ])
+ ->action(fn () => null);
+ }
+
+ public function slideOverAction(): Action
+ {
+ return Action::make('slideOverAction')
+ ->label('Update author')
+ ->form([
+ Select::make('authorId')
+ ->label('Author')
+ ->required(),
+ ])
+ ->slideOver()
+ ->action(fn () => null);
+ }
+
public function render()
{
return view('livewire.actions');
diff --git a/docs-assets/app/resources/views/livewire/actions.blade.php b/docs-assets/app/resources/views/livewire/actions.blade.php
index 660473596c..e358364c88 100644
--- a/docs-assets/app/resources/views/livewire/actions.blade.php
+++ b/docs-assets/app/resources/views/livewire/actions.blade.php
@@ -31,6 +31,18 @@
diff --git a/docs-assets/screenshots/images/dark/actions/modal/confirmation-custom-text.jpg b/docs-assets/screenshots/images/dark/actions/modal/confirmation-custom-text.jpg
new file mode 100644
index 0000000000..e022cc3edf
Binary files /dev/null and b/docs-assets/screenshots/images/dark/actions/modal/confirmation-custom-text.jpg differ
diff --git a/docs-assets/screenshots/images/dark/actions/modal/form.jpg b/docs-assets/screenshots/images/dark/actions/modal/form.jpg
new file mode 100644
index 0000000000..778f4889eb
Binary files /dev/null and b/docs-assets/screenshots/images/dark/actions/modal/form.jpg differ
diff --git a/docs-assets/screenshots/images/dark/actions/modal/slide-over.jpg b/docs-assets/screenshots/images/dark/actions/modal/slide-over.jpg
new file mode 100644
index 0000000000..a353095a08
Binary files /dev/null and b/docs-assets/screenshots/images/dark/actions/modal/slide-over.jpg differ
diff --git a/docs-assets/screenshots/images/light/actions/modal/confirmation-custom-text.jpg b/docs-assets/screenshots/images/light/actions/modal/confirmation-custom-text.jpg
new file mode 100644
index 0000000000..aef0952b3f
Binary files /dev/null and b/docs-assets/screenshots/images/light/actions/modal/confirmation-custom-text.jpg differ
diff --git a/docs-assets/screenshots/images/light/actions/modal/confirmation.jpg b/docs-assets/screenshots/images/light/actions/modal/confirmation.jpg
index 7a598b45e6..161634dea6 100644
Binary files a/docs-assets/screenshots/images/light/actions/modal/confirmation.jpg and b/docs-assets/screenshots/images/light/actions/modal/confirmation.jpg differ
diff --git a/docs-assets/screenshots/images/light/actions/modal/form.jpg b/docs-assets/screenshots/images/light/actions/modal/form.jpg
new file mode 100644
index 0000000000..25dcf0bcc3
Binary files /dev/null and b/docs-assets/screenshots/images/light/actions/modal/form.jpg differ
diff --git a/docs-assets/screenshots/images/light/actions/modal/slide-over.jpg b/docs-assets/screenshots/images/light/actions/modal/slide-over.jpg
new file mode 100644
index 0000000000..fa8195d634
Binary files /dev/null and b/docs-assets/screenshots/images/light/actions/modal/slide-over.jpg differ
diff --git a/docs-assets/screenshots/schema.js b/docs-assets/screenshots/schema.js
index 2d14c23d4b..70264f5e39 100644
--- a/docs-assets/screenshots/schema.js
+++ b/docs-assets/screenshots/schema.js
@@ -42,6 +42,51 @@ export default {
},
selector: 'body',
},
+ 'actions/modal/confirmation-custom-text': {
+ url: 'actions',
+ viewport: {
+ width: 640,
+ height: 480,
+ deviceScaleFactor: 3,
+ },
+ before: async (page) => {
+ await page.click('#confirmationModalCustomTextAction button')
+ await page.waitForSelector('#modal h2')
+
+ await new Promise((resolve) => setTimeout(resolve, 300))
+ },
+ selector: 'body',
+ },
+ 'actions/modal/form': {
+ url: 'actions',
+ viewport: {
+ width: 640,
+ height: 480,
+ deviceScaleFactor: 3,
+ },
+ before: async (page) => {
+ await page.click('#modalFormAction button')
+ await page.waitForSelector('#modal h2')
+
+ await new Promise((resolve) => setTimeout(resolve, 300))
+ },
+ selector: 'body',
+ },
+ 'actions/modal/slide-over': {
+ url: 'actions',
+ viewport: {
+ width: 1920,
+ height: 640,
+ deviceScaleFactor: 1.5,
+ },
+ before: async (page) => {
+ await page.click('#slideOverAction button')
+ await page.waitForSelector('#modal h2')
+
+ await new Promise((resolve) => setTimeout(resolve, 500))
+ },
+ selector: 'body',
+ },
'app/dashboard': {
url: 'admin',
selector: 'body',
diff --git a/docs-assets/screenshots/script.js b/docs-assets/screenshots/script.js
index b18b23cabf..a87f4adc91 100644
--- a/docs-assets/screenshots/script.js
+++ b/docs-assets/screenshots/script.js
@@ -1,9 +1,12 @@
import fs from 'fs'
import puppeteer from 'puppeteer'
import schema from './schema.js'
+import emitter from 'events'
fs.rmSync('images', { recursive: true, force: true })
+emitter.setMaxListeners(1024)
+
const themes = ['light', 'dark']
themes.forEach((theme) => {
diff --git a/packages/actions/docs/04-modals.md b/packages/actions/docs/04-modals.md
index e0f595d519..643ccf1374 100644
--- a/packages/actions/docs/04-modals.md
+++ b/packages/actions/docs/04-modals.md
@@ -32,6 +32,8 @@ Action::make('delete')
->modalButton('Yes, delete it')
```
+
+
## Modal forms
You may also render a form in the modal to collect extra information from the user before the action runs.
@@ -55,6 +57,8 @@ Action::make('updateAuthor')
})
```
+
+
### Filling the form with existing data
You may fill the form with existing data, using the `fillForm()` method:
@@ -68,16 +72,16 @@ Action::make('updateAuthor')
->fillForm([
'authorId' => $this->record->author->id,
])
- ->action(function (array $data): void {
- $this->record->author()->associate($data['authorId']);
- $this->record->save();
- })
->form([
Select::make('authorId')
->label('Author')
->options(User::query()->pluck('name', 'id'))
->required(),
])
+ ->action(function (array $data): void {
+ $this->record->author()->associate($data['authorId']);
+ $this->record->save();
+ })
```
## Custom modal content
@@ -113,6 +117,8 @@ Action::make('updateAuthor')
->slideOver()
```
+
+
Instead of opening in the center of the screen, the modal content will now slide in from the right and consume the entire height of the browser.
## Changing the modal width