Community
Trick
Show the users which fields are translatable
Aug 17, 2023
General

#Introduction

If you are using filament/spatie-laravel-translatable-plugin you probably want to show the users which fields are translatable.

With this little trick you can show the users which fields are translatable with the helper text and a nice icon.

translatable-icon-image

Simply use

TextInput::make('label')
->hint('Translatable')
->hintIcon('heroicon-m-language');

Or, what I like to do is to create a little Macro on the Filament\Forms\Components\Field class.

Like this:

Field::macro('translatable', function () {
return $this->hint('Translatable')
->hintIcon('heroicon-m-language');
});

And then use it like this:

TextInput::make('label')->translatable();

#Hope it helps!

Please email me to modrictin7@gmail.com if you have any feedback, question or suggestion.