Skip to main content
You are currently viewing the documentation for Filament 2.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.

Getting started

β€œActions” are buttons that are displayed next to the page’s heading, and allow the user to run a Livewire method on the page or visit a URL. To define actions for a page, use the getActions() method:
The button’s label is generated based on it’s name. To override it, you may use the label() method:
You may also allow the button to open a URL, using the url() method:
Buttons may have a color(). The default is primary, but you may use secondary, success, warning, or danger:
Buttons may have a size(). The default is md, but you may also use sm or lg:
Buttons may also have an icon(), which is the name of any Blade component. By default, the Blade Heroicons v1 package is installed, so you may use the name of any Heroicons v1 out of the box. However, you may create your own custom icon components or install an alternative library if you wish.

Modals

Actions may require additional confirmation or form information before they run. You may open a modal before an action is executed to do this.

Confirmation modals

You may require confirmation before an action is run using the requiresConfirmation() method. This is useful for particularly destructive actions, such as those that delete records.
Note: The confirmation modal is not available when a url() is set instead of an action(). Instead, you should redirect to the URL within the action() callback.

Custom forms

You may also render a form in this modal to collect extra information from the user before the action runs. You may use components from the Form Builder to create custom action modal forms. The data from the form is available in the $data array of the action() callback:

Filling default data

You may fill the form with default data, using the mountUsing() method:

Setting a modal heading, subheading, and button label

You may customize the heading, subheading and button label of the modal:

Custom content

You may define custom content to be rendered inside your modal, which you can specify by passing a Blade view into the modalContent() method:
By default, the custom content is displayed above the modal form if there is one, but you can add content below using modalFooter() if you wish:

Conditionally hiding the modal

You may have a need to conditionally show a modal for confirmation reasons while falling back to the default action. This can be achieved using modalHidden():

Grouping

You may use an ActionGroup object to group multiple actions together in a dropdown:

Keybindings

You can attach keyboard shortcuts to actions. These use the same key codes as Mousetrap:

Refreshing form data

If you’re using actions on an Edit or View resource page, you can refresh data within the main form using the refreshFormData() method:
This method accepts an array of model attributes that you wish to refresh in the form.