Skip to content

Route splash

The app's mark over Loading, shown in place of a page while a slow navigation loads.

<main>
  <div class="cap-route-splash" id="splash" role="status">
    <img class="cap-route-splash-mark" src="/icon-192.png" alt="Example Co" width="96" height="96" />
    <p class="cap-route-splash-label">Loading...</p>
  </div>
</main>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/route-splash.css";
import { normalPath, shouldShowRouteSplash } from "capsomer/behavior/route-splash";

Usage

<div class="cap-route-splash" role="status">
  <img class="cap-route-splash-mark" src="/icon-512.png" alt="Example Co" width="96" height="96" />
  <p class="cap-route-splash-label">Loading...</p>
</div>

API reference

RouteSplash

PropTypeRequiredDoes
mark{ src: string; alt: string }YesThe app's mark, 96px square.
labelReactNode

Functions

FunctionSignatureDoes
normalPath(pathname: string): stringA trailing slash is the same page.
shouldShowRouteSplash(navigation: SplashNavigation, isSplashPath: (pathname: string) => boolean): boolean

Parts and data attributes

ClassIs
.cap-route-splashthe root
.cap-route-splash-labela part
.cap-route-splash-marka part

Accessibility

None: it holds no control, and focus stays where the navigation left it.

  • role="status" announces "Loading..." once.
  • The label is --muted on --ground and reaches 4.5:1 (checked in the spec).