Last updated on September 1st, 2026 at 12:59 pm
The main lesson: a form field and an infolist entry may look similar, but they receive their data in different ways. A code editor can appear empty inside a Filament infolist because it expects hydrated form state, not record-display state.
What I learned
Filament separates editing components from display components. A form field such as CodeEditor normally reads from Livewire form state, often through a path like data.content. An infolist entry reads directly from the current record.
When a view page uses an infolist, Filament does not necessarily build and hydrate the form state that a form-only editor expects. The record can contain the correct value while the editor still receives an empty state.
How to choose the right fix
- Need a display-only page? Use an infolist entry that reads from the record.
- Need raw Markdown? Use a text entry, keep HTML escaping enabled, preserve whitespace, and apply a monospace font.
- Need the real code editor interface? Use an edit form so Filament hydrates form state, then disable the fields and remove write actions.
Display raw Markdown safely
For a read-only infolist, a text entry is usually the simplest choice:
TextEntry::make('content')
->fontFamily(FontFamily::Mono)
->extraAttributes([
'style' => 'white-space: pre-wrap;',
])
->columnSpanFull();
This keeps Markdown symbols visible, preserves line breaks, and avoids rendering stored text as HTML.
Use an edit form as a read-only viewer
If syntax highlighting or editor navigation is important, use a normal edit page with a populated CodeEditor. Then make the page read-only:
- Disable the fields on edit.
- Remove Save and Delete actions.
- Remove any unused view action or route.
- Test that create fields remain editable if creation is still supported.
Common mistakes
Problem: Replacing an infolist entry with a form field and expecting automatic record loading.
Fix: Use a display component, or move the field to a hydrated form.
Problem: Rendering Markdown when the goal is to inspect its source.
Fix: Keep the value escaped and preserve whitespace.
Problem: Disabling a shared form field everywhere.
Fix: Apply the disabled state only on the edit operation when create must stay usable.
Conclusion
An empty editor does not always mean the database value is missing. First check whether the component expects form state or record state. The concrete next action is to choose either a true infolist entry for display or a disabled edit form for an editor-style viewer.
