Placeholder not rendering custom HTML

Forms\Components\Placeholder::make('delegation_summary')
                            ->label('Delegation Summary')
                            ->content(function (Forms\Get $get): string {
                                $delegator = $get('delegator_id') ? User::find($get('delegator_id'))?->name : 'Not selected';
                                $delegate = $get('delegate_id') ? User::find($get('delegate_id'))?->name : 'Not selected';
                                $startDate = $get('start_date') ? date('M j, Y', strtotime($get('start_date'))) : 'Not set';
                                $endDate = $get('end_date') ? date('M j, Y', strtotime($get('end_date'))) : 'Indefinite';
                                $status = $get('is_active') ? '✅ Active' : '❌ Inactive';

                                return new HtmlString(view('filament.components.delegation-summary', [
                                    'delegator' => $delegator,
                                    'delegate' => $delegate,
                                    'startDate' => $startDate,
                                    'endDate' => $endDate,
                                    'status' => $status,
                                ])->render());
                            })
                            ->extraAttributes(['class' => 'text-sm bg-gray-50 dark:bg-gray-800 rounded-lg p-3'])
                            ->columnSpanFull(),


<div class="space-y-1 text-sm">
    <div><strong>From:</strong> {{ $delegator }}</div>
    <div><strong>To:</strong> {{ $delegate }}</div>
    <div><strong>Period:</strong> {{ $startDate }} - {{ $endDate }}</div>
    <div><strong>Status:</strong> {!! $status !!}</div>
</div>


I wonder what i did wrong here, since the custom html not rendering (refer the image).
image.png
Solution
the fix:

change:
->content(function (Forms\Get $get): string


to
->content(function (Forms\Get $get): HtmlString


😄
Was this page helpful?