How to add custom (non-stat, non-chart) widget in dashboard?
Hi, I've recently updated the privacy and terms content in my site and I want to show an alert banner with a custom action button in dashboard for non-admin users. I've seen the Filament documentation but there are examples of stat and chart widgets only. Can anyone please guide me on how to add such a widget/element on dashboard?
Solution:Jump to solution
Make your own widget class that extends the regular Filament\Widgets\Widget take a look at the source of the base class: https://github.com/filamentphp/filament/blob/3.x/packages/widgets/src/Widget.php
All you really need to do is set the view property then you can use it as a regular Livewire component...
GitHub
filament/packages/widgets/src/Widget.php at 3.x · filamentphp/filam...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
3 Replies
Why not use a pop up notification that popups all the time untill the action tells it not to?
Solution
Make your own widget class that extends the regular Filament\Widgets\Widget take a look at the source of the base class: https://github.com/filamentphp/filament/blob/3.x/packages/widgets/src/Widget.php
All you really need to do is set the view property then you can use it as a regular Livewire component
GitHub
filament/packages/widgets/src/Widget.php at 3.x · filamentphp/filam...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Thanks, it did the work. I added the content and elements in blade view.