© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
chrispage1

Accessing (parent?) data using <x-filament::button

Hi,

I am trying to use <x-filament::button within a blade file I've created.

I have a state property which is an array. Below I have two buttons:

<!-- native button -->
<button wire:click.prevent="dispatchFormEvent('calendarField:reset', state)">
    Test
</button>

<!-- filament button -->
<x-filament::button color="danger" icon="heroicon-o-x-mark" tag="button" type="submit" size="xs" wire:click.prevent="dispatchFormEvent('calendarField:reset', state)">
                Reset
            </x-filament::button>
<!-- native button -->
<button wire:click.prevent="dispatchFormEvent('calendarField:reset', state)">
    Test
</button>

<!-- filament button -->
<x-filament::button color="danger" icon="heroicon-o-x-mark" tag="button" type="submit" size="xs" wire:click.prevent="dispatchFormEvent('calendarField:reset', state)">
                Reset
            </x-filament::button>


The standard syntax button works perfectly and executes calendarField:reset and passes the state to it.

However, <x-filament::button does not and gives the error
ReferenceError: state is not defined
ReferenceError: state is not defined


I've tried using $parent.state to no avail. Any ideas?

Thanks!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

using @js in <x-filament::button wire:click="doMethod(@js($data))"> will fail
FilamentFFilament / ❓┊help
3y ago
conditionally disable <x-filament::icon-button>
FilamentFFilament / ❓┊help
3y ago
filament sorting using x-sortable
FilamentFFilament / ❓┊help
3y ago
Changing <x-filament:button> color on click of the button
FilamentFFilament / ❓┊help
5mo ago