Turbo turbo--progress
All controllers

Progress

Shows the native Turbo Drive progress bar during Turbo Frame and Stream requests, which by default only appears on full-page navigations.

Identifier: turbo--progress Loaded by: auto-loaded after php artisan hotwire:install; publish only to customize with php artisan hotwire:controllers turbo/progress.

Requirements

  • @hotwired/turbo

Usage

Add the controller to a global element in the layout (e.g. <body> or a wrapper):

HTML
<body data-controller="turbo--progress">
    ...
</body>

From that point, any Turbo Frame or Stream request will show the progress bar at the top of the page.

How it works

Turbo event Action
turbo:before-fetch-request Shows the progress bar
turbo:frame-render Hides the progress bar
turbo:before-stream-render Hides the progress bar

Example with Turbo Frame

HTML
<body data-controller="turbo--progress">
    <turbo-frame id="items" src="/items">
        <!-- The progress bar appears while this frame loads -->
    </turbo-frame>
</body>

Example with lazy loading

HTML
<body data-controller="turbo--progress">
    <turbo-frame id="dashboard-stats" src="/dashboard/stats" loading="lazy">
        <p>Loading stats...</p>
    </turbo-frame>
</body>