© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
54 replies
Nuekrato

Custom field: bind array data

I created a custom field and this custom field renders mutliple Filament Checkboxes:
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
    <div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
        <!-- Interact with the `state` property in Alpine.js -->
        <h1>Changing permissions for {{ $user()?->username}}</h1>
        @foreach ($projectPermissions() as $permission)
        <label>
            <x-filament::input.checkbox x-model="state" />
        
            <span>
            {{ $permission->name }}
            {{ $permission->destination->name }}
            </span>
        </label>
        @endforeach
    </div>

</x-dynamic-component>
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
    <div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
        <!-- Interact with the `state` property in Alpine.js -->
        <h1>Changing permissions for {{ $user()?->username}}</h1>
        @foreach ($projectPermissions() as $permission)
        <label>
            <x-filament::input.checkbox x-model="state" />
        
            <span>
            {{ $permission->name }}
            {{ $permission->destination->name }}
            </span>
        </label>
        @endforeach
    </div>

</x-dynamic-component>

As you can see I bind the input to the
state
state
. The problem is that this binds every Checkbox to the state and this results in every checkbox using the same state (so only one true/false value for all checkboxes). How can I bind each checkbox to an array in the state?
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
Next page

Similar Threads

Custom Field Send Multiple Data
FilamentFFilament / ❓┊help
16mo ago
Custom Field Event w/ Data?
FilamentFFilament / ❓┊help
3y ago
Table with Custom Array/Collection Data
FilamentFFilament / ❓┊help
3y ago
Custom Field passing dynamic data challenge
FilamentFFilament / ❓┊help
15mo ago