#What can I use instead of Placeholder in version 4?

14 messages · Page 1 of 1 (latest)

strong glen
#

'Filament\Forms\Components\Placeholder' is deprecated in version 4.
My current code

Forms\Components\Placeholder::make('name')
->label('Name')
->content(fn ($get) => $get('name')),

glass tusk
#

TextEntry with ->state()

strong glen
#

thanks.That work fine for text input fields. But I also have a question how can I embedded html from rich editor? for example -> description is from rich editor and that code not working.

TextEntry::make('review_description')
->label('Description')
->state(fn ($get) => $get('description')),

@glass tusk

peak snow
spiral minnow
strong glen
pastel valve
#

I actually got burned by this answer. TextEntry doesn't pass the data, and Placeholder does. So for any cases where you depend on data being passed through to your form or action, just know that TextEntry doens't work.

late briar
#

it isn't optimal but you could always use a custom field which does nothing but display some blade

#

or make a custom field which mimics the old placeholder behavior

onyx tusk
pastel valve
#

I mean that when I use it for actions and dump the $data attribute, those 'name' and 'infotext' values would not be included with the rest of the data.

pastel valve
#

If you want to pass a value through to a form, the best I've found is a combination of textEntry and Hidden:

Hidden::make("name"),
TextEntry::make("name"),