Livewire actions on form component layout

Hi, I'm creating a custom filament form component layout. I need to exec a function in the controller of the component but wire:click is not working for that.

I create a public function called addPreset in my controller, and in the element I add a wire:click="addPreset".

When I click it trows an error saying method not found.
Solution
It's ok if you switch to using Event.

protected function setUp(): void
{
parent::setUp();

$this->registerListeners([
'ProgressBarSection::addBar' => [
function ($component, $customValue) {
// Your code here
Notification::make()->title("You just called ProgressBarSection::addBar ")->send();
},
],
]);
$this->columnSpan('full');

}

Blade view:

<div>
<button
type="button"
wire:click="dispatchFormEvent('ProgressBarSection::addBar', '{{ $getStatePath() }}', 'extra value')"
>Click test demo Event
</button>
</div>
Was this page helpful?