Overview
Filament allows you to create completely custom pages for the app.Creating a page
To create a new page, you can use:/Pages directory of the Filament directory, and a view in the /pages directory of the Filament views directory.
Page classes are all full-page Livewire components with a few extra utilities you can use with the panel.
Authorization
You can prevent pages from appearing in the menu by overriding thecanAccess() method in your Page class. This is useful if you want to control which users can see the page in the navigation, and also which users can visit the page directly:
Adding actions to pages
Actions are buttons that can perform tasks on the page, or visit a URL. You can read more about their capabilities here. Since all pages are Livewire components, you can add actions anywhere. Pages already have theInteractsWithActions trait, HasActions interface, and <x-filament-actions::modals /> Blade component all set up for you.
Header actions
You can also easily add actions to the header of any page, including resource pages. You don’t need to worry about adding anything to the Blade template, we handle that for you. Just return your actions from thegetHeaderActions() method of the page class:
Opening an action modal when a page loads
You can also open an action when a page loads by setting the$defaultAction property to the name of the action you want to open:
$defaultActionArguments property:
action as a query string parameter to the page:
Refreshing form data
If you’re using actions on an Edit or View resource page, you can refresh data within the main form using therefreshFormData() method:
Adding widgets to pages
Filament allows you to display widgets inside pages, below the header and above the footer. To add a widget to a page, use thegetHeaderWidgets() or getFooterWidgets() methods:
getHeaderWidgets() returns an array of widgets to display above the page content, whereas getFooterWidgets() are displayed below.
If you’d like to learn how to build and customize widgets, check out the Dashboard documentation section.
Customizing the widgets’ grid
You may change how many grid columns are used to display widgets. You may override thegetHeaderWidgetsColumns() or getFooterWidgetsColumns() methods to return a number of grid columns to use:
Responsive widgets grid
You may wish to change the number of widget grid columns based on the responsive breakpoint of the browser. You can do this using an array that contains the number of columns that should be used at each breakpoint:Passing data to widgets from the page
You may pass data to widgets from the page using thegetWidgetsData() method:
$stats array property on the widget class, which will be automatically filled:
Passing properties to widgets on pages
When registering a widget on a page, you can use themake() method to pass an array of Livewire properties to it:
status in the widget class using $this->status.
Customizing the page title
By default, Filament will automatically generate a title for your page based on its name. You may override this by defining a$title property on your page class:
getTitle() method:
Customizing the page navigation label
By default, Filament will use the page’s title as its navigation item label. You may override this by defining a$navigationLabel property on your page class:
getNavigationLabel() method:
Customizing the page URL
By default, Filament will automatically generate a URL (slug) for your page based on its name. You may override this by defining a$slug property on your page class:
Customizing the page heading
By default, Filament will use the page’s title as its heading. You may override this by defining a$heading property on your page class:
getHeading() method:
Adding a page subheading
You may also add a subheading to your page by defining a$subheading property on your page class:
getSubheading() method:
Replacing the page header with a custom view
You may replace the default heading, subheading and actions with a custom header view for any page. You may return it from thegetHeader() method:
resources/views/filament/settings/custom-header.blade.php.
Rendering a custom view in the footer of the page
You may also add a footer to any page, below its content. You may return it from thegetFooter() method:
resources/views/filament/settings/custom-footer.blade.php.
Customizing the maximum content width
By default, Filament will restrict the width of the content on the page, so it doesn’t become too wide on large screens. To change this, you may override thegetMaxContentWidth() method. Options correspond to Tailwind’s max-width scale. The options are ExtraSmall, Small, Medium, Large, ExtraLarge, TwoExtraLarge, ThreeExtraLarge, FourExtraLarge, FiveExtraLarge, SixExtraLarge, SevenExtraLarge, Full, MinContent, MaxContent, FitContent, Prose, ScreenSmall, ScreenMedium, ScreenLarge, ScreenExtraLarge and ScreenTwoExtraLarge. The default is SevenExtraLarge:
Generating URLs to pages
Filament providesgetUrl() static method on page classes to generate URLs to them. Traditionally, you would need to construct the URL by hand or by using Laravel’s route() helper, but these methods depend on knowledge of the page’s slug or route naming conventions.
The getUrl() method, without any arguments, will generate a URL:
Generating URLs to pages in other panels
If you have multiple panels in your app,getUrl() will generate a URL within the current panel. You can also indicate which panel the page is associated with, by passing the panel ID to the panel argument:
Adding sub-navigation between pages
You may want to add a common sub-navigation to multiple pages, to allow users to quickly navigate between them. You can do this by defining a cluster. Clusters can also contain resources, and you can switch between multiple pages or resources within a cluster.Adding extra attributes to the body tag of a page
You may wish to add extra attributes to the<body> tag of a page. To do this, you can set an array of attributes in $extraBodyAttributes:
getExtraBodyAttributes() method: