© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Wirkhof

How to allow HTML in Placeholder in Form?

My current code is this:

Placeholder::make('custom_placeholder')
    ->live()
    ->content(function (Get $get): string {
        $html_code = '<div style="background-color: red;">' . $get('updated_at') . '</div>';
        return new HtmlString($html_code);
    })
    ->label(__('My placeholder')),
Placeholder::make('custom_placeholder')
    ->live()
    ->content(function (Get $get): string {
        $html_code = '<div style="background-color: red;">' . $get('updated_at') . '</div>';
        return new HtmlString($html_code);
    })
    ->label(__('My placeholder')),


But the output is escaped so I see <div. .. instead of just the red date.

How to make HTML work with placeholder in form?
Solution
OK, it seems that just changing the return type did the thing.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

badge in form placeholder
FilamentFFilament / ❓┊help
2y ago
Form Component Placeholder
FilamentFFilament / ❓┊help
2y ago
PlaceHolder Form Component in Infolist Section
FilamentFFilament / ❓┊help
2y ago
Placeholder not rendering custom HTML
FilamentFFilament / ❓┊help
9mo ago