Quick Tips - Filament

Filament: Add Action Button to Form Component

To add a Filament Action Button within the Filament Form component include the following:

Forms\Components\Actions::make([
	Forms\Components\Actions\Action::make('Custom Button')
		->action(function () {
					// ...
		})
]),

This can be handy, let's say you want to set a value of another field, you can do it like this:

use Filament\Forms;

Forms\Components\Text::make('custom')
	->live(onBlur: true)
	->required(),
Forms\Components\Actions::make([
	Forms\Components\Actions\Action::make('Custom Button')
		->action(function (Forms\Set $set) {
			$set('custom', 'default value');
		})
]),

Tip: Take a close look at the action namespace. Most of the time i messed them up... :)

Read more about the Filament Actions in the official documentation.