FilamentF
Filament17mo ago
Asmit

Hint action disappear.

Forms\Components\Select::make('client_id')
    ->native(false)
    ->preload()
    ->live()
    ->relationship('client', 'title',
    ->required()
    ->afterStateUpdated(function (Forms\Components\Select $select, $state) {
            $select->hintAction(
                Forms\Components\Actions\Action::make('View Client Accoutnts')
                    ->action(function () {
                        info('View Rate Card');
                    })
            );
        }
    }),

While I try to click on hint, it disappear.
Solution
Select::make('client_id')
    ->options([
        1 => 'Option 1',
        2 => 'Option 2',
    ])
    ->live()
    ->hintAction(action: fn ($state) => filled($state) ?
        Action::make('view_client')
            ->action(function () {
                //...
            }) : null)
Was this page helpful?