© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2mo ago•
12 replies
bouly

Use TextEntry in page title

✅ Solved4️⃣v4
Hello,
I would like to render a status badge next to the title in my ViewRecord page's heading. I'm trying to reuse my existing TextEntry configuration to maintain consistency, but I'm not sure how to convert it to HTML.
Here's what I've tried:

public function getHeading(): string | Htmlable
{
    $badge = TextEntry::make('status')
            ->badge()
            ->color(fn($state): string => $state->getColor())
            ->formatStateUsing(fn($state): string => $state->getLabel())
            ->toHtmlString();
            
    return new HtmlString($this->record->title . ' ' . $badge);
}
public function getHeading(): string | Htmlable
{
    $badge = TextEntry::make('status')
            ->badge()
            ->color(fn($state): string => $state->getColor())
            ->formatStateUsing(fn($state): string => $state->getLabel())
            ->toHtmlString();
            
    return new HtmlString($this->record->title . ' ' . $badge);
}


But It trigger :
Typed property Filament\Schemas\Components\Component::$container must not be accessed before initialization
Typed property Filament\Schemas\Components\Component::$container must not be accessed before initialization


Do you know if there is a way to do that? Should I instead manually create the badge in html/tailwind?

Thanks!
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

title page
FilamentFFilament / ❓┊help
3y ago
Remove page title
FilamentFFilament / ❓┊help
2y ago
Line breaks in TextEntry
FilamentFFilament / ❓┊help
10mo ago
TextEntry bulleted()
FilamentFFilament / ❓┊help
2y ago