F
Filament13mo ago
Panda

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:
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
Jump to solution
3 Replies
toeknee
toeknee13mo ago
Why not use a pop up notification that popups all the time untill the action tells it not to?
Solution
ConnorHowell
ConnorHowell13mo ago
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
Panda
PandaOP13mo ago
Thanks, it did the work. I added the content and elements in blade view.
Want results from more Discord servers?
Add your server