Skip to main content
PP

Filament 3 custom widgets with shared date filters on dashboard

Priya Patel Laravel & PHP 92 views
Working with Filament 3 and trying to create a dashboard with date-filtered widgets. I want all widgets on the page to respond to a shared date range picker. I have seen HasFiltersForm in the Filament docs but I am not sure how to wire it up so that all widgets share the same filter state. Has anyone implemented shared dashboard filters across multiple Filament widgets? I am building an analytics dashboard for an e-commerce project and need revenue, orders, and customer widgets to all filter by the same date range. Any guidance would be appreciated.

1 Reply

Best Answer
MR
Marcus Rivera 2 days ago
Priya, you need to use HasFiltersForm on the Dashboard Page class, not on individual widgets. Then each widget can access the filter values through the page. In your Dashboard page class, use the HasFiltersForm concern and define a filtersForm method that returns a Form with DatePicker fields for startDate and endDate. Then in each widget, you access the current filter values through the filters property. The widgets re-render automatically when filters change.

Post a Reply