Add alpine data to filament modal

Is there a way of accessing the x-data from inside the header slot?
<button
    type="button"
    x-on:click="$dispatch('open-modal', {id: 'custom-modal'})"
>
    Open
</button>

<x-filament::modal id="custom-modal">
    <div x-data="{ name: 'Filament' }">
        <x-slot name="header">
            Name: <span x-text="name"></span>
        </x-slot>

        <div>
          <input x-model="name" />
        </div>
    </div>
</x-filament::modal>

If I add x-data to x-filament::modal I get error with
can't access property "dispatchEvent", this.$refs.modalContainer is undefined
Was this page helpful?