#can we entangle state form field into livewire component.
4 messages · Page 1 of 1 (latest)
How can I properly sync state between a custom Filament form field and a nested Livewire component?
I’m creating a custom Filament form field using:
php artisan make:form-field MyCustomField
In the field’s Blade view, I render a child Livewire component like this:
@livewire('my-livewire-component', ['value' => $getState()], key($getStatePath()))
My goal is to synchronize the state between the Filament field and the nested Livewire component (child) — in both directions.
What I’ve tried so far:
- Passing
$getState()as a prop to the Livewire component → ✅ works - Adding a listener (
updateFieldState) in the Filament form component → ❌ likely incorrect implementation, nothing happens
Questions:
- What is the correct way to update the parent form state from a nested Livewire component?
- Is there a way to bind the child component directly to the Filament field’s state (e.g., via
entangle())? Or is Alpine.js required as a bridge?
The Filament docs don’t cover this pattern, and I want to avoid hacky workarounds if there’s a cleaner or more idiomatic way to do it.
Any insight or example would be greatly appreciated. Thanks!