How to call function inside custom form field

I'm new in writing a custom form field. I watched the laracast from Dan but I want to trigger some custom functions inside the Field Class. I tried a regular wire:click with naming the method but I get the following response:

Unable to call component method. Public method [$example] not found on component

This is my example form field:

namespace App\Forms\Components; use Filament\Forms\Components\Field; class CloudFileSelect extends Field { protected string $view = 'forms.components.cloud-file-select'; public function example() { dd('example'); } }

And this is the view:
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field" > <div class="z-10" x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }"> <button class="button hover:cursor-pointer" type="button" wire:click="example()">Open Example</button> </div> </x-dynamic-component>

I would be happy if someone can help me or give me a good source with a comprehensive example for writing my own field.
Was this page helpful?