Is there a simple way to change the color of a Placeholder field in a form?
I have a dynamically populated Placeholder field that pulls data from the database based on the value of another field, but I want to change the text color and/or background color to a lighter gray color to differentiate it from the other editable fields.
8 Replies
For example:
Thanks. One complication is that my content is already dynamically generated via a
->content(function (Get $get) : string { .....
Solution
Placeholder::make()->extraAttributes([‘class’ => ‘text-gray-400’])
Yes!
extraAttributes
was what I was looking for! Thanks so much. I was looking around the docs, not sure how I missed it (https://filamentphp.com/docs/3.x/forms/fields/getting-started#adding-extra-html-attributes).
Once I finish my first admin panel, I'm going to work on another round of documentation PR's. I have a lot of notes on where I'm getting stuck, being new to Filament. 😄Thanks im learning also this way! Sorry for the ‘wrong’ answer…
If it works, doesn’t mean it’s wrong. Sometimes, there’s just more appropriate options. Cheers.
Thanks for your help. I'm also learning and your response was helpful and I'm sure it will be useful in the future. I documented it as well. 👍