| Install | |
|---|---|
composer require maystro/filament-popup-modal |
|
| Latest Version: | v1.0.0 |
| PHP: | ^8.1 |
بسم الله والحمد لله والصلاة والصلام على رسول الله وعلى آله وصحبه
A comprehensive modal dialog system for FilamentPHP with real-time progress bars, callbacks, and full theme integration.
You can install the package via composer:
composer require maystro/filament-popup-modal
The package will automatically register itself via Laravel's package discovery.
Optionally, you can publish the config file:
php artisan vendor:publish --tag="popup-modal-config"
Optionally, you can publish the views:
php artisan vendor:publish --tag="popup-modal-views"
use Maystro\FilamentPopupModal\PopupModal;
use Maystro\FilamentPopupModal\Enums\Colors;
PopupModal::make()
->title('Success!')
->body('Operation completed successfully.')
->color(Colors::Success)
->show();
// Create progress modal
$modal = PopupModal::progressModal(
'Processing Data',
'Please wait while we process your data...',
Colors::Primary
);
$modal->show();
// Update progress
$modal->updateProgress(50);
PopupModal::make()
->title('Confirm Action')
->body('Are you sure you want to proceed?')
->color(Colors::Warning)
->confirm(true)
->onConfirm(function () {
// Your action here
Notification::make()->title('Confirmed!')->success()->send();
})
->show();
PopupModal::make()
->title('Important Notice')
->body('This is an important message.')
->icon('heroicon-o-exclamation-triangle')
->iconSize('lg') // sm, md, lg
->color(Colors::Warning)
->show();
// Quick popup
show_popup('Hello', 'This is a quick popup!', Colors::Info);
// Progress popup
$modal = show_progress_popup('Processing...', 'Please wait...');
update_popup_progress($modal->getData()['id'], 75);
Add to your config/app.php:
'aliases' => [
// ... other aliases
'PopupModal' => Maystro\FilamentPopupModal\Facades\PopupModal::class,
],
Then use:
PopupModal::make()->title('Hello')->show();
| Method | Description | Parameters |
|---|---|---|
make(string $id = null) |
Create new modal instance | Optional unique ID |
title(string $title) |
Set modal title | Title text |
body(string $body) |
Set modal body content | Body HTML/text |
color(Colors|string $color) |
Set theme color | Color enum or string |
icon(string $icon) |
Set custom icon | Heroicon name |
iconSize(string $size) |
Set icon size | 'sm', 'md', 'lg' |
width(string $width) |
Set modal width | 'xs' to '7xl' |
confirm(bool $hasConfirm) |
Show confirm button | Boolean |
confirmLabel(string $label) |
Customize confirm button | Button text |
closeLabel(string $label) |
Customize close button | Button text |
onConfirm(callable $callback) |
Set confirm callback | Closure function |
onClose(callable $callback) |
Set close callback | Closure function |
progress(int $percent) |
Set progress percentage | 0-100 |
showProgress(int $percent) |
Show progress bar | Initial percentage |
hideProgress() |
Hide progress bar | - |
updateProgress(int $percent) |
Update progress real-time | New percentage |
timeout(int $ms) |
Auto-close timeout | Milliseconds |
show() |
Display the modal | - |
close() |
Close the modal | - |
PopupModal::progressModal($title, $body, $color) // Create progress modal
PopupModal::updateProgressById($id, $percent) // Update any modal's progress
popup_modal($id) // Create instance
show_popup($title, $body, $color, $icon) // Quick popup
show_progress_popup($title, $body, $color) // Progress popup
update_popup_progress($modalId, $percent) // Update progress
The package uses Filament's standardized color palette:
Colors::Primary // Main brand color
Colors::Secondary // Secondary accent
Colors::Success // Green success states
Colors::Warning // Orange warning states
Colors::Danger // Red error states
Colors::Info // Blue informational
Colors::Gray // Neutral gray
The config file allows you to customize default values:
return [
'default_confirm_label' => 'Confirm',
'default_close_label' => 'Close',
'progress' => [
'default_color' => 'primary',
'update_interval' => 500,
'completion_delay' => 1500,
],
'modal' => [
'default_width' => 'lg',
'default_color' => 'info',
'default_icon_size' => 'md',
'auto_register' => true,
],
'icons' => [
'auto_assign' => true,
'fallback_icon' => 'heroicon-o-information-circle',
],
];
composer test
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.