Skip to main content

Introduction

Filament allows you to build dynamic dashboards comprised of “widgets”. Each widget is a component that displays data in a specific way, helping you create rich, interactive admin panels and information displays. Widgets are Livewire components that can display stats, charts, tables, or any custom content you need. They’re commonly used on dashboard pages, but can also be integrated into resource pages and custom layouts.

Widget Types

Filament provides several built-in widget types:
  • Stats Overview Widgets: Display key metrics and statistics with optional charts
  • Chart Widgets: Render interactive charts using Chart.js
  • Table Widgets: Display data in tabular format
  • Custom Widgets: Build completely custom widgets with your own views

Creating a Widget

Use the make:filament-widget Artisan command to create a widget:
The command will prompt you to select a widget type:
  • Custom - A blank widget you can customize
  • Chart - A chart widget
  • Stats overview - A stats overview widget
  • Table - A table widget
This creates a widget class in app/Filament/Widgets/ and registers it automatically if you’re using widget discovery.

Dashboard Widgets

By default, widgets are displayed on the main dashboard page. Filament automatically discovers widgets in the app/Filament/Widgets directory.

Widget Discovery

To enable automatic widget discovery, configure it in your panel provider:

Manual Widget Registration

You can also manually register widgets:

Disabling Default Widgets

Filament includes two default widgets on the dashboard. To disable them:

Ordering Widgets

Control the order in which widgets appear using the $sort property:
Lower numbers appear first. Widgets without a sort value appear after sorted widgets.

Widget Width and Layout

Control how much space a widget occupies using the $columnSpan property:

Responsive Widget Widths

Make widget widths responsive using an array:

Customizing the Widgets Grid

By default, widgets are displayed in a 2-column grid. To customize this, you need to create a custom dashboard page.

Creating a Custom Dashboard

Create a new dashboard page:
Register it in your panel configuration:

Responsive Widget Grids

Make the grid responsive:

Multiple Dashboards

Create multiple dashboard pages for different purposes:

Conditionally Hiding Widgets

Hide widgets based on user permissions or other conditions:

Widget Polling

Many widgets support live polling to automatically refresh data:

Lazy Loading

By default, widgets are lazy-loaded (only rendered when visible):
This is useful for widgets that should always be loaded, even if initially off-screen.

Filtering Widget Data

You can add filters to your dashboard that affect all widgets.

Using a Filter Form

Add filters using the HasFiltersForm trait:

Using a Filter Action

For a cleaner UI, use a filter action modal:

Accessing Filters in Widgets

Use the InteractsWithPageFilters trait to access filter data:

Persisting Filters

By default, filters persist in the user’s session. To disable:

Table Widgets

Table widgets display data in tabular format using Filament’s table builder:
Configure the table in your widget:

Custom Widgets

Create completely custom widgets for unique requirements:
This creates a widget class and view:
In your view:

Using Widgets Outside Dashboards

Widgets can be used on resource pages and custom pages:

Widget Headings and Descriptions

Add headings and descriptions to widgets:
Or use methods for dynamic values:

Best Practices

  1. Keep Widgets Focused: Each widget should display one type of information clearly
  2. Use Appropriate Types: Choose stats for metrics, charts for trends, tables for detailed data
  3. Consider Performance: Use caching for expensive queries, especially with polling enabled
  4. Responsive Design: Test widgets on different screen sizes using responsive column spans
  5. Lazy Loading: Keep lazy loading enabled for widgets below the fold
  6. Filter Consistency: When using dashboard filters, ensure all widgets handle them appropriately
  7. Sort Logically: Place most important widgets at the top using the $sort property

Next Steps