Scroll Reveal

Fade and slide content in as it scrolls into view. Supports directions, effects, stagger and repeat.

This component requires softui.js for interactive behavior.

Basic

Fades up into view

Revealed once, the first time it enters the viewport.

<div class="sui-card sui-reveal" style="padding:24px;max-width:360px;">
  <h4 style="margin-bottom:8px;">Fades up into view</h4>
  <p style="color:var(--sui-text-muted);font-size:14px;">Revealed once, the first time it enters the viewport.</p>
</div>

Directions

Up
Down
Start
End
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;width:100%;">
  <div class="sui-card sui-reveal" style="padding:20px;text-align:center;">Up</div>
  <div class="sui-card sui-reveal sui-reveal-down" style="padding:20px;text-align:center;">Down</div>
  <div class="sui-card sui-reveal sui-reveal-start" style="padding:20px;text-align:center;">Start</div>
  <div class="sui-card sui-reveal sui-reveal-end" style="padding:20px;text-align:center;">End</div>
</div>

Effects

Fade
Scale
Zoom Out
Blur
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;width:100%;">
  <div class="sui-card sui-reveal sui-reveal-fade" style="padding:20px;text-align:center;">Fade</div>
  <div class="sui-card sui-reveal sui-reveal-scale" style="padding:20px;text-align:center;">Scale</div>
  <div class="sui-card sui-reveal sui-reveal-zoom-out" style="padding:20px;text-align:center;">Zoom Out</div>
  <div class="sui-card sui-reveal sui-reveal-blur" style="padding:20px;text-align:center;">Blur</div>
</div>

Speed

Fast
Default
Slow
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;width:100%;">
  <div class="sui-card sui-reveal sui-reveal-fast" style="padding:20px;text-align:center;">Fast</div>
  <div class="sui-card sui-reveal" style="padding:20px;text-align:center;">Default</div>
  <div class="sui-card sui-reveal sui-reveal-slow" style="padding:20px;text-align:center;">Slow</div>
</div>

Stagger

Design

0ms

Build

120ms

Ship

240ms

<div data-reveal-stagger="120" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:16px;width:100%;">
  <div class="sui-card sui-reveal" style="padding:20px;">
    <h4 style="margin-bottom:6px;">Design</h4>
    <p style="color:var(--sui-text-muted);font-size:13px;">0ms</p>
  </div>
  <div class="sui-card sui-reveal" style="padding:20px;">
    <h4 style="margin-bottom:6px;">Build</h4>
    <p style="color:var(--sui-text-muted);font-size:13px;">120ms</p>
  </div>
  <div class="sui-card sui-reveal" style="padding:20px;">
    <h4 style="margin-bottom:6px;">Ship</h4>
    <p style="color:var(--sui-text-muted);font-size:13px;">240ms</p>
  </div>
</div>

Repeat

Wrapped card

The wrapper reveals; the card keeps its hover lift. Scroll away and back to replay.

<div class="sui-reveal sui-reveal-start" data-reveal-repeat style="max-width:360px;">
  <div class="sui-card sui-card-hover" style="padding:24px;">
    <h4 style="margin-bottom:8px;">Wrapped card</h4>
    <p style="color:var(--sui-text-muted);font-size:14px;">The wrapper reveals; the card keeps its hover lift. Scroll away and back to replay.</p>
  </div>
</div>

JavaScript API

<button class="sui-btn sui-btn-primary" onclick="addCard()">Add a card</button>
<div id="revealList" style="display:flex;flex-direction:column;gap:12px;max-width:360px;"></div>

<script>
  function addCard() {
    var card = document.createElement('div');
    card.className = 'sui-card sui-reveal sui-reveal-scale';
    card.style.padding = '16px 20px';
    card.textContent = 'Added at ' + new Date().toLocaleTimeString();
    document.getElementById('revealList').appendChild(card);
    SoftUI.reveal(card);
  }
</script>

Reference

Class / Attribute / Token / APIDescription
sui-revealFades up on first scroll into view; content already on screen at load shows at once. It sets opacity, so put it on a wrapper around interactive components.
sui-reveal-down sui-reveal-start sui-reveal-endSlide direction; start and end flip in RTL.
sui-reveal-fade sui-reveal-scaleOpacity only, or grow in from 95%.
sui-reveal-zoom-out sui-reveal-blurShrink in from 108%, or sharpen from a blur.
sui-reveal-fast sui-reveal-slow0.3s / 1.2s; on the element or any parent.
data-reveal-stagger="80"On a parent: each .sui-reveal child waits this many ms longer (default 80).
data-reveal-repeatHides again when it leaves the viewport and replays on return.
--sui-reveal-distanceSlide distance (default 24px).
--sui-reveal-durationAnimation length (default 0.6s).
--sui-reveal-blurStarting blur for .sui-reveal-blur (default 8px).
--sui-delayDelay before this element starts (default 0ms).
SoftUI.reveal(target, opts)Reveal added content: no argument, a selector, an element or a list.
opts.rootMargin / opts.thresholdObserver options, read on the first call only (defaults 0px 0px -10% 0px and 0.1).
SoftUI.init(el)Also picks up .sui-reveal inside el.
prefers-reduced-motionContent is always visible and nothing animates. The same applies without JS and in print.
TabFocusing content that has not revealed yet shows it at once.

Delete this item?

This action cannot be undone. This will permanently delete the item and remove all associated data.