is it possible to add loading screen

I want to ask is it possible to add loading state in forms\components\section while make all the component ready after update? If possible how to achive that? Thank you!
Solution:
Something like this ```php Forms\Components\Section::make([ Forms\Components\Placeholder::make('')...
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira2mo ago
could you explain what are you trying to do?
thyk123
thyk1232mo ago
Hello, thank you for the respond, i really gratefull for that! So, take an example when we are try to set another field with
->afterStateUpdated(Set $set)
->afterStateUpdated(Set $set)
Livewire try update the another field right, but it takes time. I want to show a loading information for that, so user can know that field is tring to fetch data. But instead showing loading animation in that field, i want to show the loading animation or something inside
Forms\Components\Section::make('')
Forms\Components\Section::make('')
So the whole section showing a loading that tells user something has been change and takes a time Is that possible?
Solution
LeandroFerreira
LeandroFerreira2mo ago
Something like this
Forms\Components\Section::make([
Forms\Components\Placeholder::make('')
->content(new HtmlString(<<<'BLADE'
<div wire:loading wire:target="data.title">
Loading...
</div>
BLADE
)),
Forms\Components\TextInput::make('title')
->live(onBlur: true)
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
$set('slug', str($state)->slug());
}),
Forms\Components\TextInput::make('slug')
])
Forms\Components\Section::make([
Forms\Components\Placeholder::make('')
->content(new HtmlString(<<<'BLADE'
<div wire:loading wire:target="data.title">
Loading...
</div>
BLADE
)),
Forms\Components\TextInput::make('title')
->live(onBlur: true)
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
$set('slug', str($state)->slug());
}),
Forms\Components\TextInput::make('slug')
])
thyk123
thyk1232mo ago
Thank you so much! Sorry for my late respond