Attributes and Meta Tags
﹟ Data Attributes
The following data attributes can be applied to elements to customize Turbo’s behaviour.
data-turbo="false"
disables Turbo Drive on links and forms including descendants. To reenable when an ancestor has opted out, usedata-turbo="true"
. Use with caution as this can impact Back button behavior.data-turbo-track="reload"
tracks the element’s HTML and performs a full page reload when it changes. Typically used to keepscript
and CSSlink
elements up-to-date.data-turbo-frame
identifies the Turbo Frame to navigate. Refer to the Frames documentation for further details.data-turbo-action
customizes the Visit action. Valid values arereplace
oradvance
. Can also be used with Turbo Frames to promote frame navigations to page visits.data-turbo-permanent
persists the element between page loads. The element must have a uniqueid
attribute.data-turbo-cache="false"
removes the element before the document is cached, preventing it from reappearing on restoration Visits.data-turbo-eval="false"
prevents inlinescript
elements from being re-evaluated on Visits.data-turbo-method
changes the link request type from the defaultGET
. Ideally, non-GET
requests should be triggered with forms, butdata-turbo-method
might be useful where a form is not possible.data-turbo-confirm
presents a confirm dialog with the given value. Can be used onform
elements or links withdata-turbo-method
.
﹟ Automatically Added Attributes
The following attributes are automatically added by Turbo and are useful to determine the Visit state at a given moment.
disabled
is added to the form submitter while the form request is in progress, to prevent repeat submissions.data-turbo-preview
is added to thehtml
element when displaying a preview during a Visit.aria-busy
is added tohtml
andturbo-frame
elements when a navigation is in progress.
﹟ Meta Tags
The following meta
elements, added to the head
, can be used to customize caching and Visit behavior.
<meta name="turbo-cache-control">
to opt out of caching.<meta name="turbo-visit-control" content="reload">
will perform a full page reload.<meta name="turbo-root">
to scope Turbo Drive to a particular root location.