Action class is the foundation for all interactive operations in Filament. Actions can open modals, execute callbacks, redirect users, and more. They’re used throughout tables, forms, pages, and other components.
Namespace
Inheritance
Extends:Filament\Support\Components\ViewComponent
Implements: Arrayable
Static Methods
make()
Create a new action instance.The unique identifier for this action. If
null, uses the default name from getDefaultName().Returns the action instance for method chaining.
getDefaultName()
Get the default name for the action.Returns the default name or
null.fromArray()
Create an action from an array representation.The array data to create the action from.
Returns the configured action instance.
Display Methods
label()
Set the action label.The label text to display.
Returns the action instance for method chaining.
icon()
Set the action icon.The icon identifier (e.g., ‘heroicon-o-pencil’).
Returns the action instance for method chaining.
color()
Set the action color.The color name or array of color values.
Returns the action instance for method chaining.
button()
Render the action as a button.Returns the action instance for method chaining.
iconButton()
Render the action as an icon button (no label).Returns the action instance for method chaining.
link()
Render the action as a link.Returns the action instance for method chaining.
badge()
Render the action as a badge.The badge content. If no arguments are provided, renders as a badge view.
Returns the action instance for method chaining.
size()
Set the action size.The size (e.g., Size::Small, Size::Medium, Size::Large).
Returns the action instance for method chaining.
Behavior Methods
action()
Set the callback to execute when the action is triggered.A closure to execute or a string method name.
Returns the action instance for method chaining.
requiresConfirmation()
Require confirmation before executing the action.Whether confirmation is required.
Returns the action instance for method chaining.
modalHeading()
Set the modal heading.The modal heading text.
Returns the action instance for method chaining.
modalDescription()
Set the modal description.The modal description text.
Returns the action instance for method chaining.
modalSubmitActionLabel()
Set the submit button label.The submit button label.
Returns the action instance for method chaining.
form()
Add a form to the action modal.An array of form components or a closure returning components.
Returns the action instance for method chaining.
URL and Redirect Methods
url()
Set a URL for the action.The URL to navigate to.
Whether to open the URL in a new tab.
Returns the action instance for method chaining.
redirect()
Redirect after the action executes.The URL to redirect to after execution.
Returns the action instance for method chaining.
Notification Methods
successNotification()
Show a success notification after the action executes.The notification instance or a closure returning a notification.
Returns the action instance for method chaining.
State Control
disabled()
Disable the action.Whether the action is disabled.
Returns the action instance for method chaining.
hidden()
Hide the action.Whether the action is hidden.
Returns the action instance for method chaining.
visible()
Show the action based on a condition.Whether the action is visible.
Returns the action instance for method chaining.
Authorization
authorize()
Set the authorization check.Whether the action is authorized.
Returns the action instance for method chaining.
Lifecycle Hooks
before()
Execute a callback before the action runs.The callback to execute before the action.
Returns the action instance for method chaining.
after()
Execute a callback after the action runs.The callback to execute after the action.
Returns the action instance for method chaining.
Special Methods
call()
Execute the action programmatically.Parameters to pass to the action.
Returns the result of the action callback.
success()
Mark the action as successful.failure()
Mark the action as failed.halt()
Halt the action execution.Whether to roll back the database transaction.
cancel()
Cancel the action execution.Whether to roll back the database transaction.
Closure Parameters
Action closures automatically receive contextual parameters:Action arguments passed from the frontend.
Form data from the action modal.
The parent Livewire component.
The Eloquent model instance.
The current record (alias for model).
Selected records (for bulk actions).
The table instance (for table actions).
View Constants
Related Classes
- BulkAction - Actions for multiple records
- Table - Table actions
- Page - Page actions