F
Filament11mo 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
toeknee11mo ago
This has just been after into V3.2
caglar
caglarOP11mo 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
caglarOP11mo ago
I'm using TextEntry class in an infolist and it doesn't work with password() method.
Tieme
Tieme11mo ago
It is not implemented on the infolist, only on forms.
caglar
caglarOP11mo ago
Thanks a lot.
Want results from more Discord servers?
Add your server