Develops with Turbo Drive for SPA-like navigation. Activates when configuring page morphing with x-turbo::refreshes-with; working with data-turbo, data-turbo-track, data-turbo-permanent, or data-turbo-preload attributes; managing cache control with x-turbo::exempts-page-from-cache, x-turbo::exempts-page-from-preview, or x-turbo::page-requires-reload; enabling view transitions with x-turbo::page-view-transition; handling form redirects with TurboMiddleware; customizing the progress bar; or when the user mentions Turbo Drive, navigation, page morphing, prefetching, or asset tracking.
Turbo Drive accelerates navigation by intercepting link clicks and form submissions, making them as fetch requests. It replaces the <body> and merges the <head> without tearing down the JavaScript environment, giving SPA-like speed with server-rendered HTML.
<a href> links to the same domain, updates the URL via the History API, fetches the new page, and renders the HTML response.fetch requests. Turbo follows the redirect and renders the response.<body>, merges <head>. The window, document, and <html> element persist across navigations.Turbo.visit(). Issues a fetch, renders HTML. Advance pushes to history; replace modifies the current entry.Instead of replacing the entire <body>, Turbo can morph the existing page to preserve DOM state (form inputs, scroll positions, focus):
@verbatim
@endverbatim
When method="morph" is set, Turbo uses DOM morphing for same-page refreshes. When scroll="preserve" is set, scroll position is maintained.
Disable Turbo on a link, form, or entire section by adding data-turbo="false":
<a href="/external" data-turbo="false">Regular navigation</a>
<div data-turbo="false">
<!-- All links and forms inside are excluded from Turbo -->
<a href="/also-regular">This too</a>
<!-- Re-enable for specific elements -->
<a href="/turbo-again" data-turbo="true">Back to Turbo</a>
</div>
fetch request.IMPORTANT: Turbo requires redirect responses (303 See Other) for non-GET form submissions. Laravel's redirect() helper handles this correctly when the TurboMiddleware is active — it automatically converts 302 redirects to 303 for Turbo requests.
For validation errors, return a 422 status with the form HTML so Turbo can render it in place. To make it easier, Turbo Laravel will catch validation exceptions and redirect to the form based on the resources automatically (*.update to *.edit or *.store to *.create or *.destroy to *.delete) when the form route exists.
Mark assets with data-turbo-track="reload" so Turbo reloads the page when they change (e.g., after a deploy):
<link rel="stylesheet" href="/app.css?v=123" data-turbo-track="reload">
<script src="/app.js?v=123" data-turbo-track="reload"></script>
When Turbo detects tracked assets have changed, it performs a full page reload instead of a Turbo visit.
Turbo shows a progress bar at the top of the page for navigations taking longer than 500ms. Customize it with CSS:
.turbo-progress-bar {
height: 3px;
background-color: #3b82f6;
}
Turbo prefetches links on mouseenter by default. Control this behavior:
<!-- Disable prefetching for a specific link -->
<a href="/heavy-page" data-turbo-preload="false">Heavy page</a>
<!-- Eagerly preload a link (fetches on page load) -->
<a href="/likely-next" data-turbo-preload>Likely next page</a>
Elements with data-turbo-permanent persist across navigations. Useful for media players, maps, or other stateful elements:
<div id="audio-player" data-turbo-permanent>
<audio src="/music.mp3"></audio>
</div>
The element must have a matching id in both the current and new page.
@verbatim
Control how Turbo caches pages using Blade components in your layout's <head>:
{{-- Cache the page but don't show preview during navigation --}} <x-turbo::exempts-page-from-preview />
{{-- Force a full page reload when visiting this page --}} <x-turbo::page-requires-reload /> </code-snippet>
@endverbatim
Enable the View Transitions API for smooth animated transitions between pages:
@verbatim
@endverbatim
This renders <meta name="view-transition" content="same-origin" />, enabling CSS-driven page transitions.