Liking cljdoc? Tell your friends :D

<x-splash>

A full-viewport loading/splash screen overlay. Covers the page while an app initializes and dismisses with a fade-out animation when the active attribute is removed.

Tag Name

x-splash

Attributes

AttributeTypeDefaultDescription
activeboolean(absent)Present = overlay visible. Remove to trigger fade-out.
variantstring"default"Visual style: default, branded, minimal
progressnumber(absent)When present, shows a progress bar (0–100).
spinnerbooleantrueShows the built-in CSS spinner. Set spinner="false" to hide.
overlaystring"solid"Background mode: solid, blur, transparent

Properties

PropertyTypeReflects Attribute
activebooleanactive
variantstringvariant
progressnumber \| nullprogress
spinnerbooleanspinner
overlaystringoverlay

Events

EventBubblesComposedCancelableDetail
x-splash-hiddenyesyesno{}

Fires after the fade-out animation completes (or immediately when prefers-reduced-motion: reduce is active).

Slots

SlotDescription
(default)Custom content — logos, text, animations. Centered above the spinner and progress bar.

Parts

PartElementDescription
overlay<div>Full-viewport backdrop
content<div>Centering wrapper for slot + spinner + progress
spinner<span>Built-in CSS ring animation
progress<div>Progress bar track
bar<div>Progress bar fill

CSS Custom Properties

Custom PropertyDefaultDescription
--x-splash-bg#ffffff / #0f172aOverlay background
--x-splash-color#0f172a / #f8fafcText / foreground color
--x-splash-z-index9999Overlay stacking order
--x-splash-fade-duration400msFade-out transition duration
--x-splash-fade-easecubic-bezier(0.4,0,0.2,1)Fade easing curve
--x-splash-spinner-size40pxSpinner diameter
--x-splash-spinner-colorcurrentColorSpinner arc color
--x-splash-spinner-track-colorrgba(0,0,0,0.12)Spinner track ring color
--x-splash-spinner-thickness3pxSpinner border width
--x-splash-spinner-duration0.75sSpinner rotation period
--x-splash-progress-height4pxProgress bar height
--x-splash-progress-color#3b82f6Progress bar fill color
--x-splash-progress-track-colorrgba(0,0,0,0.08)Progress bar track color
--x-splash-progress-radius2pxProgress bar border-radius
--x-splash-gap20pxSpacing between slot, spinner, progress
--x-splash-blur-amount8pxBlur for overlay="blur"
--x-splash-branded-bg(fallback to --x-splash-bg)Background for variant="branded"

Accessibility

  • role="status" and aria-live="polite" when active
  • aria-busy="true" while loading, removed on hide
  • aria-label="Loading" default (override via aria-label attribute)
  • Progress bar has role="progressbar" with aria-valuemin, aria-valuemax, aria-valuenow
  • Respects prefers-reduced-motion: reduce — skips fade animation

Usage Examples

Basic splash screen

<x-splash active></x-splash>

<script>
  // When app is ready:
  document.querySelector('x-splash').removeAttribute('active');
</script>

With custom content

<x-splash active>
  <img src="/logo.svg" alt="App Logo" width="120">
  <p>Loading your workspace...</p>
</x-splash>

With progress bar

<x-splash active progress="0" spinner="false">
  <h2>Initializing...</h2>
</x-splash>

<script>
  const splash = document.querySelector('x-splash');
  // Update progress as resources load
  splash.progress = 30;
  splash.progress = 60;
  splash.progress = 100;
  // Done
  splash.active = false;
</script>

Blur overlay

<x-splash active overlay="blur">
  <p>Loading...</p>
</x-splash>

Listening for the hidden event

<x-splash active id="splash"></x-splash>

<script>
  const splash = document.getElementById('splash');
  splash.addEventListener('x-splash-hidden', () => {
    splash.remove(); // clean up after fade-out completes
  });
  // Later:
  splash.active = false;
</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