Skip to content

FOUT (Flash of Unstyled Text) on page load. (And the default font is always loaded) #18936

@anvauy

Description

@anvauy

Package

filament/filament

Package Version

v4.5.2

Laravel Version

v12.46.0

Livewire Version

v3.7.3

PHP Version

8.4.16

Problem description

While the page loads, a slight change in the typography is noticeable as the browser finishes loading the font to be used.

Expected behavior

The problem has a visual effect that makes navigating between pages less "clean". The same thing happens when using SPAs (only the first page loads).

Recording.2026-01-10.190041.mp4

### Solution found (I don't know if it's the best)
Preload the font, instructing the browser to prioritize loading.
Using <link rel="preload":

head>
 <!-- ... -->
 <link rel="preload" href="/fonts/filament/filament/inter/inter-latin-wght-normal-NRMW37G5.woff2" as="font" type="font/woff2" crossorigin>
</head>

To implement this with Filament, add a hook to AppServiceProvider:

public function boot(): void
{
    FilamentView::registerRenderHook(
        PanelsRenderHook::STYLES_BEFORE,
        fn (): string =>
            '<link rel="preload" href="/fonts/filament/filament/inter/inter-latin-wght-normal-NRMW37G5.woff2" as="font" type="font/woff2" crossorigin />',
        );
}

### Result:

Recording.2026-01-10.192526.mp4

Note:

Another thing I noticed is that even if a different font is used and the local font provider is selected, Filament registers the "Inter" font in the FilamentAsset.
Image

_It does so in: vendor/filament/filament/src/FilamentServiceProvider.php packageBooted():

Image

Is there a way to remove "Inter" without touching vendor/filament files?

Steps to reproduce

With any new project. I'm using Windows 11 and the Chrome browser.

In AdminPanelProvider:

class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->topNavigation(true)
->topbar(true)

...

Reproduction repository (issue will be closed if this is not valid)

https://github.com/anvauy/demo-issue-fout-app.git

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions