Skip to main content
The 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

Filament\Actions\Action

Inheritance

Extends: Filament\Support\Components\ViewComponent Implements: Arrayable

Static Methods

make()

Create a new action instance.
public static function make(?string $name = null): static
name
string | null
The unique identifier for this action. If null, uses the default name from getDefaultName().
return
static
Returns the action instance for method chaining.
Example:
use Filament\Actions\Action;

Action::make('edit')
    ->label('Edit Post')
    ->icon('heroicon-o-pencil')
    ->action(fn (Post $record) => $this->editPost($record));

getDefaultName()

Get the default name for the action.
public static function getDefaultName(): ?string
return
string | null
Returns the default name or null.

fromArray()

Create an action from an array representation.
public static function fromArray(array $data): static
data
array<string, mixed>
The array data to create the action from.
return
static
Returns the configured action instance.

Display Methods

label()

Set the action label.
public function label(string | Htmlable | Closure | null $label): static
label
string | Htmlable | Closure | null
The label text to display.
return
static
Returns the action instance for method chaining.

icon()

Set the action icon.
public function icon(string | Closure | null $icon): static
icon
string | Closure | null
The icon identifier (e.g., ‘heroicon-o-pencil’).
return
static
Returns the action instance for method chaining.

color()

Set the action color.
public function color(string | array | Closure | null $color): static
color
string | array | Closure | null
The color name or array of color values.
return
static
Returns the action instance for method chaining.
Example:
Action::make('delete')
    ->color('danger')
    ->icon('heroicon-o-trash');

button()

Render the action as a button.
public function button(): static
return
static
Returns the action instance for method chaining.

iconButton()

Render the action as an icon button (no label).
public function iconButton(): static
return
static
Returns the action instance for method chaining.
Render the action as a link.
public function link(): static
return
static
Returns the action instance for method chaining.

badge()

Render the action as a badge.
public function badge(string | int | float | Closure | null $badge = null): static
badge
string | int | float | Closure | null
The badge content. If no arguments are provided, renders as a badge view.
return
static
Returns the action instance for method chaining.

size()

Set the action size.
public function size(Size | string | Closure | null $size): static
size
Size | string | Closure | null
The size (e.g., Size::Small, Size::Medium, Size::Large).
return
static
Returns the action instance for method chaining.

Behavior Methods

action()

Set the callback to execute when the action is triggered.
public function action(string | Closure | null $action): static
action
string | Closure | null
A closure to execute or a string method name.
return
static
Returns the action instance for method chaining.
Example:
Action::make('approve')
    ->action(function (Model $record) {
        $record->update(['status' => 'approved']);
    });

requiresConfirmation()

Require confirmation before executing the action.
public function requiresConfirmation(bool | Closure $condition = true): static
condition
bool | Closure
default:"true"
Whether confirmation is required.
return
static
Returns the action instance for method chaining.
Example:
Action::make('delete')
    ->requiresConfirmation()
    ->action(fn (Model $record) => $record->delete());

modalHeading()

Set the modal heading.
public function modalHeading(string | Htmlable | Closure | null $heading): static
heading
string | Htmlable | Closure | null
The modal heading text.
return
static
Returns the action instance for method chaining.

modalDescription()

Set the modal description.
public function modalDescription(string | Htmlable | Closure | null $description): static
description
string | Htmlable | Closure | null
The modal description text.
return
static
Returns the action instance for method chaining.

modalSubmitActionLabel()

Set the submit button label.
public function modalSubmitActionLabel(string | Htmlable | Closure | null $label): static
label
string | Htmlable | Closure | null
The submit button label.
return
static
Returns the action instance for method chaining.

form()

Add a form to the action modal.
public function form(array | Closure $schema): static
schema
array | Closure
An array of form components or a closure returning components.
return
static
Returns the action instance for method chaining.
Example:
use Filament\Forms\Components\TextInput;

Action::make('updateEmail')
    ->form([
        TextInput::make('email')
            ->email()
            ->required(),
    ])
    ->action(function (array $data, Model $record) {
        $record->update($data);
    });

URL and Redirect Methods

url()

Set a URL for the action.
public function url(string | Closure | null $url, bool | Closure $shouldOpenInNewTab = false): static
url
string | Closure | null
The URL to navigate to.
shouldOpenInNewTab
bool | Closure
default:"false"
Whether to open the URL in a new tab.
return
static
Returns the action instance for method chaining.
Example:
Action::make('view')
    ->url(fn (Post $record) => route('posts.show', $record), shouldOpenInNewTab: true);

redirect()

Redirect after the action executes.
public function redirect(string | Closure | null $url): static
url
string | Closure | null
The URL to redirect to after execution.
return
static
Returns the action instance for method chaining.

Notification Methods

successNotification()

Show a success notification after the action executes.
public function successNotification(Notification | Closure | null $notification = null): static
notification
Notification | Closure | null
The notification instance or a closure returning a notification.
return
static
Returns the action instance for method chaining.
Example:
use Filament\Notifications\Notification;

Action::make('publish')
    ->action(fn (Post $record) => $record->publish())
    ->successNotification(
        Notification::make()
            ->success()
            ->title('Post published')
            ->body('The post has been published successfully.')
    );

State Control

disabled()

Disable the action.
public function disabled(bool | Closure $condition = true): static
condition
bool | Closure
default:"true"
Whether the action is disabled.
return
static
Returns the action instance for method chaining.

hidden()

Hide the action.
public function hidden(bool | Closure $condition = true): static
condition
bool | Closure
default:"true"
Whether the action is hidden.
return
static
Returns the action instance for method chaining.
Example:
Action::make('edit')
    ->hidden(fn (Model $record) => ! auth()->user()->can('update', $record));

visible()

Show the action based on a condition.
public function visible(bool | Closure $condition = true): static
condition
bool | Closure
default:"true"
Whether the action is visible.
return
static
Returns the action instance for method chaining.

Authorization

authorize()

Set the authorization check.
public function authorize(bool | Closure $condition): static
condition
bool | Closure
Whether the action is authorized.
return
static
Returns the action instance for method chaining.
Example:
Action::make('delete')
    ->authorize(fn (Model $record) => auth()->user()->can('delete', $record));

Lifecycle Hooks

before()

Execute a callback before the action runs.
public function before(Closure $callback): static
callback
Closure
The callback to execute before the action.
return
static
Returns the action instance for method chaining.

after()

Execute a callback after the action runs.
public function after(Closure $callback): static
callback
Closure
The callback to execute after the action.
return
static
Returns the action instance for method chaining.
Example:
Action::make('process')
    ->before(fn () => Log::info('Processing started'))
    ->action(fn (Model $record) => $record->process())
    ->after(fn () => Log::info('Processing completed'));

Special Methods

call()

Execute the action programmatically.
public function call(array $parameters = []): mixed
parameters
array<string, mixed>
default:"[]"
Parameters to pass to the action.
return
mixed
Returns the result of the action callback.

success()

Mark the action as successful.
public function success(): void

failure()

Mark the action as failed.
public function failure(): void

halt()

Halt the action execution.
public function halt(bool $shouldRollBackDatabaseTransaction = false): void
shouldRollBackDatabaseTransaction
bool
default:"false"
Whether to roll back the database transaction.

cancel()

Cancel the action execution.
public function cancel(bool $shouldRollBackDatabaseTransaction = false): void
shouldRollBackDatabaseTransaction
bool
default:"false"
Whether to roll back the database transaction.

Closure Parameters

Action closures automatically receive contextual parameters:
arguments
array
Action arguments passed from the frontend.
data
array
Form data from the action modal.
livewire
Component
The parent Livewire component.
model
Model | null
The Eloquent model instance.
record
Model | null
The current record (alias for model).
records
Collection
Selected records (for bulk actions).
table
Table | null
The table instance (for table actions).

View Constants

public const BADGE_VIEW = 'filament::components.badge';
public const BUTTON_VIEW = 'filament::components.button.index';
public const GROUPED_VIEW = 'filament::components.dropdown.list.item';
public const ICON_BUTTON_VIEW = 'filament::components.icon-button';
public const LINK_VIEW = 'filament::components.link';

Build docs developers (and LLMs) love