Search 71 components and 72 controllers by name, category or description.
Meta
Opt-in bundle of validated Hotwire meta tags with practical defaults
The umbrella tag
ConceptualOne tag states everything the page opts into. A prop you leave out renders nothing, so the head never claims a behaviour the application did not ask for. The output below is this component rendered for real, on this request.
Rendered into the head
<meta name="turbo-prefetch" content="true">
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
<meta name="csrf-token" content="VrQ84b2Qs3VUf1k3QykTOcEFL2M3IhXZ1bgLZVYp">
<head>
<hw:meta csrf prefetch refresh />
</head>
Overriding a default
ConceptualA bare attribute takes the granular component's own default; passing a value overrides it. prefetch is the exception to false meaning "leave it out" — there, false is the value the meta exists to state, so it renders and disables link prefetching.
Rendered into the head
<meta name="turbo-prefetch" content="false">
<meta name="turbo-cache-control" content="no-cache">
<meta name="turbo-root" content="/app">
<meta name="csrf-token" content="VrQ84b2Qs3VUf1k3QykTOcEFL2M3IhXZ1bgLZVYp">
<hw:meta csrf prefetch="false" cache="no-cache" root="/app" />
refresh and scroll are one component
ConceptualTwo props over a single tag pair: writing either renders both metas. If one half is false while the other asks for the pair, the false half falls back to its default rather than disappearing.
Three separate renders, in order
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="reset">
<meta name="turbo-refresh-method" content="replace">
<meta name="turbo-refresh-scroll" content="preserve">
<hw:meta refresh />
<hw:meta scroll="reset" />
<hw:meta refresh="replace" scroll="false" />
Granular components
ConceptualEach tag also stands on its own, with the same default the umbrella uses. Reach for these when a layout composes the head from more than one place.
Rendered into the head
<meta name="turbo-prefetch" content="false">
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
<meta name="turbo-cache-control" content="no-cache">
<meta name="turbo-visit-control" content="reload">
<meta name="turbo-root" content="/app">
<meta name="view-transition" content="same-origin">
<meta name="csrf-token" content="VrQ84b2Qs3VUf1k3QykTOcEFL2M3IhXZ1bgLZVYp">
<hw:meta.prefetch enabled="false" />
<hw:meta.refresh method="morph" scroll="preserve" />
<hw:meta.cache control="no-cache" />
<hw:meta.visit-control />
<hw:meta.root path="/app" />
<hw:meta.view-transition />
<hw:meta.csrf />
color-scheme brings the pre-paint script
ConceptualOn the umbrella, color-scheme also renders <hw:color-scheme.script />, so data-theme is applied before CSS paints and the page never flashes the wrong theme. The granular components stay single-purpose and emit only their own tag.
Rendered into the head
<script>
(() => {
const storageKey = "hotwire.colorScheme";
const defaultMode = "system";
const attribute = "data-theme";
let mode = defaultMode;
try {
mode = localStorage.getItem(storageKey) || defaultMode;
} catch (error) {}
if (!['light', 'dark', 'system'].includes(mode)) {
mode = defaultMode;
}
const scheme = mode === 'system'
? (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
: mode;
document.documentElement.setAttribute(attribute, scheme);
document.documentElement.setAttribute('data-color-scheme-mode', mode);
document.documentElement.style.colorScheme = scheme;
})();
</script>
<meta name="color-scheme" content="light dark">
<hw:meta color-scheme />
Values are validated, not silently ignored
ConceptualA wrong value throws instead of rendering a meta the browser would quietly drop. The message names what is supported — this is the real exception, caught and printed.
InvalidArgumentException
Unsupported meta.refresh method value. Supported values: replace, morph.
<hw:meta.refresh method="morf" />