Preloader Collection
Three preloader overlay animations — text reveal, staircase slide, and pixel dissolve — each revealing the content with its own signature exit once loading finishes.
This is a WebberUI Pro component
Free during the launch campaign: sign up or sign in, then hit “Copy install command” in the preview above and it installs straight away — no payment, no credit card. The command below returns 401 while you are signed out.
npx shadcn@latest add "https://webberui.com/r/preloader-collection.json?t=<install token>"Playground
Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.
<PreloaderCollection />
Installation
npx shadcn@latest add "https://webberui.com/r/preloader-collection.json?t=<install token>"Or, once registries are configured in components.json, install it as @webberui/preloader-collection.
Usage
import { PreloaderCollection } from "@/components/ui/preloader-collection";
// Uncontrolled: shows on mount and exits automatically once minDuration has passed
<PreloaderCollection variant="staircase" label="WEBBER" />
// Controlled: you decide when it closes (for example, once data has loaded)
const [loading, setLoading] = React.useState(true);
<PreloaderCollection
variant="pixel"
loading={loading}
label="Loading"
onComplete={() => console.log("revealed")}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "text" | "staircase" | "pixel" | "text" | Animation style: text reveal / staircase slide / pixel dissolve |
loading | boolean | — | Controlled visibility; the exit is triggered by true→false. When omitted, the component is uncontrolled |
minDuration | number | 1400 | In uncontrolled mode, the minimum time it stays visible before exiting automatically (milliseconds) |
position | "fixed" | "absolute" | "fixed" | Overlay positioning: full screen, or snapped to the nearest positioned ancestor |
label | string | "Loading" | Centered label text (the main subject for the text variant, a caption for the others) |
progress | number | — | Progress percentage (0–100); when provided the number is shown, without affecting exit timing |
columns | number | 6 / 14 | Number of columns for staircase (default 6) / cells per row for pixel (default 14) |
onComplete | () => void | — | Callback after the exit animation has fully finished and the DOM has unmounted |
How it works
- Controlled and uncontrolled modes: without
loadingit is uncontrolled — the component covers the screen on mount, then exits automatically onceminDurationhas passed, which suits a simple entrance overlay. Passingloadinghands control to the outside, usually bound to the loading state of data or routing;true→falseplays the exit, reveals the content underneath, and callsonCompleteonce every animation has finished. - Three signature exits:
textslides the whole panel upward while the label flickers character by character in a wave;staircaseslices the overlay into several columns that slide up staggered by index into a staircase on exit;pixeltiles the overlay with near-square pixel cells sized to its dimensions, and on exit scans diagonally, shrinking cell by cell into a pixel dissolve. The centered loading motion of each (bouncing dots, equalizer, flickering pixel matrix) matches its own exit vocabulary. - Self-adjusting pixel grid: the
pixelvariant measures the overlay's width and height withResizeObserverand derives the row count fromcolumnsso each cell comes out near square; the measurement happens in a layout effect before paint, so the cell count never jumps. Adjacent tiles are padded with a same-coloroutlineto fill sub-pixel hairline seams, so no light leaks through while the overlay is up. - Positioning scope:
position="fixed"covers the whole viewport, which suits a page-level preloader;position="absolute"covers only the nearestrelative/absoluteancestor, which suits section-level loading (inside a card or a panel, say) — the demo uses this mode. - Progress display: when
progressis passed, every variant shows the percentage number and updatesaria-valuenow;progressis purely for display and announcement, while whether it exits is still decided byloading(orminDuration), so the two can be controlled independently.
Accessibility
- With
progressthe overlay isrole="progressbar"(carryingaria-valuemin/max/now), otherwiserole="status" aria-live="polite", along witharia-busyand anaria-label; every tile and decorative motion isaria-hidden, so the screen reader hears the label and the progress only once. - When the user has "reduce motion" enabled at the system level, it switches to a static overlay showing only the label and the progress, and the exit is a plain fade out with no tile animation.
- The overlay carries
select-noneandcursor-waitand blocks interaction with the layer underneath using solid tiles, so users cannot accidentally hit content that is not ready yet during loading.
Cursor Tooltip
An elastic tooltip that follows the cursor, tracking its coordinates with a spring and flipping sides automatically near the edges, with keyboard focus anchoring.
Page Transition
A route transition container combining View Transitions concepts with overlay reveals, playing one of four transitions — fade, slide, cover, or wipe — whenever the route changes.