Reveal
Render a staggered entrance cascade for direct children or explicitly selected nested items. CSS owns the first-paint animation; the controller progressively adds per-item scroll triggering, Turbo integration, and synchronization events.
Basic Usage
Direct children are reveal items by default, with no per-item markup:
<hw:reveal>
@foreach ($tasks as $task)
<x-task-card :task="$task" />
@endforeach
</hw:reveal>
The root and items are polymorphic:
<hw:reveal as="ul">
<li>First</li>
<li>Second</li>
</hw:reveal>
Explicit nested items
Use <hw:reveal.item> when the animated units are not direct children. The parent analyzes the rendered structure and
supplies sequential indexes across the nested markup:
<hw:reveal as="section" delay="110ms" motion="flat">
<hw:form>
<hw:reveal.item>
<hw:field name="title" label="Title" />
</hw:reveal.item>
<div>
<hw:reveal.item as="section">
<hw:field name="description" label="Description" />
</hw:reveal.item>
</div>
</hw:form>
</hw:reveal>
The first explicit item switches the root out of direct-child mode. Raw data-reveal-item is a low-level escape hatch
for explicit items inside a Reveal root, not a root-scoped annotation. Every raw item participates in the document-order
sequence, but the server only writes a missing index to an item that also opts in with data-slot="reveal-item".
Structural CSS matches data-reveal-item globally, so putting it in a reusable partial animates that partial wherever
it
renders; a stream insertion outside a Reveal root replays the entrance. Add the marker at the Reveal composition site
instead. For an intentionally standalone item, add data-reveal-skip to the stream payload
when its entrance should not replay.
For a list of reusable partials, let <hw:reveal> own direct-child mode. It emits data-reveal-children automatically
and keeps the partial markup neutral. The controller assigns missing indexes in document order, but that happens only
after it connects. Set --reveal-index server-side when the visual order differs or when the stagger must be correct on
the first paint rather than progressively corrected after controller loading.
<hw:reveal.item> receives a deterministic server index from the rendered HTML structure of its nearest
<hw:reveal> or <hw:sidebar reveal> root. Nested roots maintain independent sequences, including a manually mounted
data-controller="reveal" inside a package root. A Blade wrapper that creates a package root can index item markup
passed
through its slot because indexing happens after the slot renders. A manually mounted root outside a package root has no
server resolver, so the controller assigns missing indexes in document order after connecting. Outside any Reveal
controller an item remains a CSS animation item with the default index 0, but has no controller lifecycle.
Independent sequences share the same clock: the first item of a nested root starts together with the first item of the
outer root, and the nested root takes no position in the outer sequence. To continue the cascade after the outer items,
give the nested root a delay covering the outer steps before it:
<hw:reveal stagger="90ms">
<hw:reveal.item>Overview</hw:reveal.item>
<hw:reveal.item>Usage</hw:reveal.item>
{{-- Two outer steps × 90ms. --}}
<hw:reveal stagger="90ms" delay="180ms">
<hw:reveal.item>Requests</hw:reveal.item>
<hw:reveal.item>Errors</hw:reveal.item>
</hw:reveal>
</hw:reveal>
The offset is not derived from the outer root, so update it when the number of outer items before the nested root or the outer stagger changes.
An application component can opt into the same server indexing contract without consuming Blade context:
<div data-slot="reveal-item" data-reveal-item>
{{ $slot }}
</div>
The resolver only adds a missing --reveal-index; an inline value supplied by the application is always preserved.
When a component must own the Reveal root without an extra wrapper, prefer that component's explicit integration when
available. <hw:sidebar reveal>, for example, mounts Reveal directly on its existing
surface and accepts explicit data-reveal-item descendants.
Scroll trigger
Use trigger="scroll" for long pages and lists below the fold:
<hw:reveal trigger="scroll" :threshold="0.2" root-margin="0px 0px -10% 0px">
...
</hw:reveal>
The controller observes items individually, leaves anything already visible untouched, and restarts the stagger index
for each batch entering the viewport. For an item taller than the observer root, the threshold is capped at the maximum
ratio that can fit in the viewport. At the end of the document it releases items left inside a negative root-margin
dead zone. once defaults to true; set :once="false" to reveal an item again after it leaves and re-enters.
This is presentation, not lazy loading: all content remains in the document and accessibility tree.
Motion and timing
The structural foundation routes three motions, while the selected preset supplies their visual blur and shift values:
| Motion | Effect |
|---|---|
rise |
Fade, blur, and vertical movement. |
flat |
Fade and vertical movement without filter. |
fade |
Opacity only. |
Use motion="flat" to omit filter, including when the blur itself causes a rendering conflict. Use motion="fade"
when an item contains a fixed-position dropdown, popover, tooltip, or overlay: both filter and transform create a
containing block while present, and only fade omits both. Reveal uses animation-fill-mode: backwards, so those
properties are released after every animation instead of changing fixed positioning permanently.
Timing props become inline CSS custom properties on the root:
<hw:reveal stagger="45ms" duration="420ms" delay="90ms" :max-steps="8">
...
</hw:reveal>
| Prop | Custom property | Structural fallback | Bloom |
|---|---|---|---|
stagger |
--reveal-stagger |
70ms |
90ms |
duration |
--reveal-duration |
520ms |
680ms |
delay |
--reveal-delay |
0ms |
— |
max-steps |
--reveal-max-steps |
11 |
— |
Each item starts after delay + min(index, max-steps) × stagger, so max-steps caps the delay for long lists. Override
--reveal-blur, --reveal-shift, or --reveal-easing on the root
for smaller adjustments. To supply an application keyframe while preserving the stagger formula and backwards fill,
set --reveal-animation:
<hw:reveal style="--reveal-animation: product-enter">
...
</hw:reveal>
Nova uses the structural defaults (6px blur, 0.75rem shift, 520ms duration and 70ms stagger). Bloom uses a
softer authored profile (12px, 1.25rem, 680ms and 90ms) with a longer ease-out curve. Explicit stagger,
duration and other component props still override the selected preset through inline custom properties.
Application defaults
Presets declare their profile in the components layer on the Reveal root, not on :root, so a value set on :root
is shadowed wherever the preset declares the same property. Target the root selectors instead; an unlayered application
rule wins over the preset and changes every package root without editing markup:
[data-slot="reveal"],
[data-slot="sidebar-container"][data-controller~="reveal"],
[data-slot="sidebar"][data-controller~="reveal"] {
--reveal-duration: 320ms;
--reveal-stagger: 60ms;
}
Component props still win because they render inline. A manually mounted data-controller="reveal" root without
data-slot="reveal" matches neither the preset nor this rule and uses the structural fallbacks under every preset; set
the custom properties on that root directly.
Render and document scope
scope="render" repeats the entrance when Turbo renders new page content. Use scope="document" for persistent chrome
such as a sidebar; after the first Turbo visit, subsequent renders do not replay that cascade.
<hw:reveal scope="document">
...
</hw:reveal>
Turbo previews can otherwise paint stale visible content before replaying its entrance. For page-level Reveal without a
View Transition, pair it with <hw:meta cache="no-preview" />. The umbrella <hw:meta view-transition /> implies
cache="no-preview" automatically unless an explicit cache value, including false, is supplied.
While any Reveal controller is connected, a Turbo Stream replace, update, or morph with at least one target inside
Reveal markup marks its shared template before insertion. Split mixed Reveal and non-Reveal destinations into separate
stream elements when they need different animation behavior. See the controller's
Turbo lifecycle for the exact target and payload rules. Transient armed and
completed state is removed before Turbo caches the page.
Integration
- A descendant
animated-numberrestarts when its Reveal batch is shown, unless its own lazy observer is still waiting for the counter to enter the viewport. <hw:progress>indicators animate from zero in sync with their owning item: they start--reveal-progress-delay(120ms) after it and run for--reveal-progress-duration(900ms). Set either on the root to change them.- Listen for
reveal:shownto coordinate application behavior or achart:
<hw:reveal data-action="reveal:shown->analytics#track">
...
</hw:reveal>
The event fires for the initial visible batch and once per animation frame for scroll batches. It does not fire on connect when every item is still offscreen.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
trigger |
string |
'load' |
load or per-item scroll. |
scope |
string |
'render' |
render or persistent document scope. |
motion |
string |
'rise' |
rise, flat, or fade. |
stagger |
?string |
preset | Delay between item indexes. |
duration |
?string |
preset | Entrance duration. |
delay |
?string |
0ms |
Initial delay before the first item. |
max-steps |
int|string|null |
11 |
Maximum stagger index used by the delay formula. |
threshold |
number|string |
0.15 |
IntersectionObserver threshold for scroll. |
root-margin |
string |
'0px 0px -10% 0px' |
IntersectionObserver root margin for scroll. |
once |
bool |
true |
Reveal each scroll item only once. |
as |
string |
'div' |
Root HTML element. |
stimulus |
Htmlable|null |
null |
Additional Stimulus bindings merged on the root. |
Root tags support div, section, main, header, footer, aside, nav, ul, and ol. Item tags support div,
article, section, header, footer, aside, and li. Regular HTML attributes pass through. Reveal-owned
data-reveal-*, data-slot, and data-motion attributes are protected; use props to configure them.
Progressive enhancement
Structural CSS contains the visibility, delay formula, armed state, flat/fade routing, layer-safe fallback
keyframes,
Turbo safeguards, and reduced-motion fallback. The selected preset supplies visual motion variables. A preset may
redefine the named fallback keyframes in its own components layer without replacing the scheduling machinery. This
split means the initial cascade starts before the lazy controller chunk connects. If JavaScript is disabled or fails,
content still completes its CSS animation and remains visible; trigger="scroll" simply degrades to the load cascade.
With prefers-reduced-motion: reduce, animations are disabled, armed opacity is released, and the controller does not
observe or restart animated numbers.
Avoid making a Reveal item the same element whose visibility another state controls with opacity. CSS animations win
over normal opacity declarations while running, so a hidden item can flash through the Reveal keyframe and disappear
when backwards fill releases it. Animate a stable wrapper instead, or suppress Reveal in the conflicting state. The
shipped presets do this for desktop group labels in an icon-collapsed Sidebar while preserving their mobile and expanded
entrances.
Turning the cascade off
Set data-reveal="off" on <html> to neutralise every Reveal in the document without editing the markup that emits
them:
<html data-reveal="{{ config('app.reveal', 'on') }}">
This silences the item and progress animations and releases armed opacity, so content that would be waiting on a scroll
is simply visible. It is the same treatment prefers-reduced-motion: reduce applies, under an author's switch rather
than the visitor's preference — which stays honoured either way.
Individual instances do not need the switch: drop the <hw:reveal> wrapper, or the reveal prop on components that
expose one.
Styling hooks
data-slot="reveal"data-slot="reveal-item"data-reveal-itemdata-reveal-childrenon roots using automatic direct childrendata-motion="rise|flat|fade"data-reveal-scope="render|document"data-reveal-armedwhile a scroll item waits outside the viewportdata-reveal-state="done"after every finite animation settlesdata-reveal-skipon incoming replacement content
Controller
This component depends on the reveal controller.