© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
David Vincent

afterStateHydrated behavior within Block builder

I have an TextInput field within a Block, and I would like to fill it with uuid when it's empty. I am doing that:
Forms\Components\TextInput::make('internal')
                        ->afterStateHydrated(function ($component, $state) {
                            if (! $state) {
                                $component->state(Str::uuid()->toString());
                            }
                        })
                        ->disabled()
                        ->suffixAction(CopyAction::make())
                        ->dehydrateStateUsing(fn ($state) => $state ?? Str::uuid()->toString()),
Forms\Components\TextInput::make('internal')
                        ->afterStateHydrated(function ($component, $state) {
                            if (! $state) {
                                $component->state(Str::uuid()->toString());
                            }
                        })
                        ->disabled()
                        ->suffixAction(CopyAction::make())
                        ->dehydrateStateUsing(fn ($state) => $state ?? Str::uuid()->toString()),

But it's not working. Any thoughts?
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

Big Builder Block - Page Builder
FilamentFFilament / ❓┊help
6mo ago
Action afterStateHydrated
FilamentFFilament / ❓┊help
2y ago
Builder inside Custom Block Modal
FilamentFFilament / ❓┊help
7mo ago
Form builder custom block picker
FilamentFFilament / ❓┊help
9mo ago