Validation messages are not htmlable, but they output htmlable label values by default
When I create a TextInput field, I can make the label htmlable:
This is fine, however validation messages are currently not htmlable, and this leads to an undesired bug in the output of validation messages, see image.
Is there a way to solve this?
Right now it seems the only solution to this it to completely customise the validation messages, but this is unfeasible. Ideally, the validation message might either take the rendered label html, or would be htmlable too.
Or is there some other way around this?

Solution:Jump to solution
I just discovered
->validationAttribute()
, which solves this by allowing you to independently define the attribute used in validation messages!!!4 Replies
Not that I know off?
Are you just trying to style the label with CSS and wrapping a span on it? If so, perhaps using extra html attributes and applying a class instead? https://filamentphp.com/docs/3.x/forms/fields/getting-started#adding-extra-html-attributes
Yes - that’s what we’ll have to do, thanks. But I still think there’s room for a code improvement above - if label() is htmlable, any markup will be be rendered raw in the validation message. So either another input attribute must be used for the validation placeholder, or htmlable must be removed. Right?
Solution
I just discovered
->validationAttribute()
, which solves this by allowing you to independently define the attribute used in validation messages!!!