F
Filament14mo ago
caglar

How to use an icon like a button

I'd like to show and hide password by clicking the icon. Is it possible to apply?
6 Replies
toeknee
toeknee14mo ago
This has just been after into V3.2
caglar
caglarOP14mo ago
TextEntry::make('password')
->label('Password')
->icon('heroicon-o-key')
->iconColor('primary')
->getStateUsing(function ($record) {
$credential = $record->credentials()->where('loginunpw', 1)->first();

return $credential ? $credential->pass : 'No Password Found';
})
->formatStateUsing(fn ($state): string => Str::mask('secret', '*', 0))
->copyable()
->copyableState(fn (string $state): string => $state)
->copyMessage('Copied!'),
TextEntry::make('password')
->label('Password')
->icon('heroicon-o-key')
->iconColor('primary')
->getStateUsing(function ($record) {
$credential = $record->credentials()->where('loginunpw', 1)->first();

return $credential ? $credential->pass : 'No Password Found';
})
->formatStateUsing(fn ($state): string => Str::mask('secret', '*', 0))
->copyable()
->copyableState(fn (string $state): string => $state)
->copyMessage('Copied!'),
caglar
caglarOP14mo ago
I'm using TextEntry class in an infolist and it doesn't work with password() method.
Tieme
Tieme14mo ago
It is not implemented on the infolist, only on forms.
caglar
caglarOP14mo ago
Thanks a lot.

Did you find this page helpful?