Liking cljdoc? Tell your friends :D

x-liquid-fill

A scroll progress indicator that fills with animated liquid. The liquid surface has organic wave motion driven by SVG path morphing, reacts to scroll speed (gentle waves when steady, aggressive sloshing when fast), and splashes with inertia when scrolling stops suddenly. Supports themed gradients (gold, water, lava) with an SVG specular lighting filter for a metallic sheen.

Tag Name

x-liquid-fill

Attributes

AttributeTypeDefaultRangeDescription
targetstring(auto)CSS selectorScroll container to observe. Auto = nearest scrollable ancestor or window
orientationstringverticalvertical / horizontalScroll direction to track
modestringfillfill / barFull container fill vs thin progress bar
themestringgoldgold / water / lava / customColor preset
wave-intensitynumber0.50 – 1Base wave amplitude multiplier
splash-intensitynumber0.70 – 1Splash/inertia effect strength
layersnumber32 – 5Number of overlapping wave layers
disabledbooleanfalseDisables animation and scroll tracking

Properties

PropertyTypeAttributeDescription
targetstringtargetScroll target CSS selector
orientationstringorientationScroll direction
modestringmodeFill mode
themestringthemeColor preset
waveIntensitynumberwave-intensityWave amplitude multiplier
splashIntensitynumbersplash-intensitySplash effect strength
layersnumberlayersNumber of wave layers
disabledbooleandisabledDisables animation
progressnumber(read-only)Current fill progress 0–1

Events

EventDetailWhen
x-liquid-fill-progress{ progress: number, velocity: number }Scroll progress changes

Slots

SlotDescription
(default)Content displayed above the liquid

CSS Custom Properties

PropertyDefault (gold theme)Description
--x-liquid-fill-color-1#B8860BGradient stop 1 (deep)
--x-liquid-fill-color-2#D4AF37Gradient stop 2 (mid)
--x-liquid-fill-color-3#F9F295Gradient stop 3 (highlight)
--x-liquid-fill-specular-colorrgba(255,255,240,0.6)Specular highlight tint
--x-liquid-fill-opacity1Overall liquid opacity
--x-liquid-fill-wave-speed1Wave animation speed multiplier
--x-liquid-fill-bgtransparentContainer background
--x-liquid-fill-bordernoneContainer border
--x-liquid-fill-radius0Container border-radius
--x-liquid-fill-bar-height14pxHeight of the bar in bar mode

Shadow Parts

PartElementDescription
container<div>Outer wrapper
svg<svg>SVG containing liquid paths
content<div>Content layer above the liquid

Theme Presets

ThemeColor 1Color 2Color 3Specular
gold#B8860B#D4AF37#F9F295rgba(255,255,240,0.6)
water#0077B6#00B4D8#90E0EFrgba(255,255,255,0.5)
lava#8B0000#FF4500#FF8C00rgba(255,255,200,0.7)
custom(CSS var)(CSS var)(CSS var)(CSS var)

Accessibility

  • SVG is aria-hidden="true" (decorative)
  • Respects prefers-reduced-motion: reduce — renders flat fill, no waves
  • Supports light/dark mode via prefers-color-scheme

Usage

Basic scroll progress (page-level)

<x-liquid-fill style="position:fixed; right:0; top:0; width:60px; height:100vh;">
</x-liquid-fill>

Track a specific container

<div id="content" style="overflow-y:auto; height:400px;">
  <!-- scrollable content -->
</div>
<x-liquid-fill target="#content" style="width:100%; height:200px;">
</x-liquid-fill>

Bar mode

<x-liquid-fill mode="bar" style="width:100%;"></x-liquid-fill>

Themes

<x-liquid-fill theme="gold"></x-liquid-fill>
<x-liquid-fill theme="water"></x-liquid-fill>
<x-liquid-fill theme="lava"></x-liquid-fill>

Custom colours

<x-liquid-fill theme="custom" style="
  --x-liquid-fill-color-1: #2d1b69;
  --x-liquid-fill-color-2: #7c3aed;
  --x-liquid-fill-color-3: #c4b5fd;
  --x-liquid-fill-specular-color: rgba(255,255,255,0.4);
"></x-liquid-fill>

With content overlay

<x-liquid-fill id="prog" style="width:80px; height:80px; border-radius:50%;">
  <span id="pct" style="
    display:flex; align-items:center; justify-content:center;
    width:100%; height:100%; font-weight:bold; color:white;
  ">0%</span>
</x-liquid-fill>

<script>
  document.getElementById('prog')
    .addEventListener('x-liquid-fill-progress', e => {
      document.getElementById('pct').textContent =
        Math.round(e.detail.progress * 100) + '%';
    });
</script>

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close