Installation:
composer require awcodes/shout
Ensure you’re using a compatible Filament version (check the compatibility table).
Theme Integration: Add the package’s Blade views to your custom theme CSS file (required for styling):
@source '../../../../vendor/awcodes/shout/resources/**/*.blade.php';
If using Filament Panels, follow Filament’s theme setup guide first.
First Use Case:
Add a Shout component to a Filament form or infolist:
use Awcodes\Shout\Shout;
Shout::make('This is a contextual notice!')
->icon('heroicon-o-information-circle')
->color('info');
Form Integration:
Use Shout in form sections to guide users:
Form::section([
Shout::make('Required fields are marked with an asterisk (*).')
->color('warning')
->icon('heroicon-o-exclamation-circle'),
])->columns(1),
Infolist Context: Display notices alongside data:
Infolist::column('status')->badge()
->extraAttributes(['class' => 'mb-2'])
->afterStateUpdated(function (string $state) {
return Shout::make('Status updated to: ' . $state)
->color('success')
->icon('heroicon-o-check-circle');
}),
Dynamic Content:
Pass variables to Shout for dynamic messages:
Shout::make("You have {$user->unreadNotifications} unread notifications.")
->color('primary')
->icon('heroicon-o-bell'),
.shout-* classes.__() helper for translatable messages:
Shout::make(__('This field is required.'))
->color('danger')
->icon('heroicon-o-x-circle'),
if ($record->is_archived) {
Shout::make('This record is archived.')
->color('secondary')
->icon('heroicon-o-archive');
}
Missing Theme Setup:
@source isn’t added to your CSS.@source matches your project structure (e.g., ../../../../vendor/ for Laravel).Icon Conflicts:
@source '../../../../vendor/filament/support/resources/views/components/icon.blade.php';
Blade Context:
Shout components must be used within Filament’s Blade context (e.g., forms/infolists). Avoid direct Blade rendering.Shout component renders. Missing styles often indicate a theme issue.php artisan view:clear
php artisan cache:clear
Custom Colors:
Extend the Shout class to add themes:
namespace App\Filament\Components;
use Awcodes\Shout\Shout;
class CustomShout extends Shout {
public static function make(string $message): static {
return parent::make($message)->color('custom');
}
}
Add CSS for .shout-custom.
Animation: Use Tailwind’s transition utilities in your theme:
.shout-enter-active {
@apply transition-opacity duration-300;
}
.shout-enter-from {
@apply opacity-0;
}
Accessibility:
Ensure aria-live attributes for dynamic updates:
Shout::make('Updated!')
->extraAttributes(['aria-live' => 'polite'])
->color('success'),
How can I help you explore Laravel packages today?