F
Filament16mo 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
toeknee16mo ago
This has just been after into V3.2
caglar
caglarOP16mo 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
caglarOP16mo ago
I'm using TextEntry class in an infolist and it doesn't work with password() method.
Tieme
Tieme16mo ago
It is not implemented on the infolist, only on forms.
caglar
caglarOP16mo ago
Thanks a lot.

Did you find this page helpful?