Intro Loader

Flipbook Preloader for React

A page-load intro that counts to 100 with the real loading while a flipbook of your work plays in a small frame, then grows the last image into its place on the page. It doesn't fade out: its last frame is the page's first.

  • Preloader
  • Hero
  • Image

Uses clsx, tailwind-merge

Open in ChatGPTOpen in Claude
minDuration1.6s(replays the demo)
maxDuration4.0s(replays the demo)
growDuration0.90s(replays the demo)
riseDuration0.90s(replays the demo)
stagger0.07s(replays the demo)
<IntroLoader />

replays the demo when you let go.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Intro Loader: A page-load intro that counts to 100 with the real loading while a flipbook of your work plays in a small frame, then grows the last image into its place on the page. It doesn't fade out: its last frame is the page's first.
This demo, Studio: A studio's home page. Four projects flip past in the frame, then the fifth grows into the full-bleed hero, and the headline rises over it. Press reload in the address bar to play it again, or click to skip.

1. Install it:
   npx shadcn@latest add @keyframeui/intro-loader-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/intro-loader-demo.json instead.)
   It adds the demo, components/intro-loader-demo.tsx, and the component, components/ui/intro-loader.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <IntroLoader> on its own.

3. These props set its feel. Change them before you change the file:
   - minDuration (default 1.6): Shortest the count can take, in seconds, even when everything has already loaded, so it doesn't flash past on a fast connection. The whole intro runs about 1.3 seconds longer.
   - maxDuration (default 4): Longest it waits for the fonts, the images and the page's images in view, in seconds, before landing anyway. While it waits, the count creeps on its own, so it never sits at 99.
   - growDuration (default 0.9): How long the last image, or the mark, takes to grow into its place on the page, in seconds. The loader's background clears over the end of it.
   - riseDuration (default 0.9): How long each line takes to rise into place after the handoff, in seconds.
   - stagger (default 0.07): Seconds between lines as they rise, in reading order.

4. Don't change, in components/ui/intro-loader.tsx:
   - Everything that moves is a Web Animation of a transform, a clip-path or an opacity; the only script that runs each frame is the count, so it stays smooth while React hydrates.
   - `introLoader` runs as an inline <script> serialized with toString(), so it stays self-contained: no outer variables, no imports, no async or object spread. It reads its timing from the plan's `t`, never from TIMING directly.
   - The last image is laid out at the target's size from the start, then scaled down and masked to the frame, so the handoff only undoes that and lands on the target pixel for pixel.
   - Order: count to 100 with the flipbook, the counter leaves, a breath, the handoff grows into the target as the background clears, then lines rise a stagger apart in reading order.
   - Reduced motion shows no loader, only a quick crossfade into the page after `fade.delay`.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/intro-loader.md

Installation

Add the component on its own with the CLI, or copy the file in by hand.

The CLI writes components/ui/intro-loader.tsx and installs clsx and tailwind-merge. It needs the @keyframeui registry in components.json; add it once per project.

npx shadcn@latest add @keyframeui/intro-loader

Examples

Finished sections built with Intro Loader. Each one installs whole, with the component included.

Lookbook

A season label instead of a number, and a tall frame for the looks. The last look lands as the half of the page beside the headline.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Intro Loader: A page-load intro that counts to 100 with the real loading while a flipbook of your work plays in a small frame, then grows the last image into its place on the page. It doesn't fade out: its last frame is the page's first.
This demo, Lookbook: A season label instead of a number, and a tall frame for the looks. The last look lands as the half of the page beside the headline.

1. Install it:
   npx shadcn@latest add @keyframeui/intro-loader-lookbook-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/intro-loader-lookbook-demo.json instead.)
   It adds the demo, components/intro-loader-lookbook-demo.tsx, and the component, components/ui/intro-loader.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <IntroLoader> on its own.

3. These props set its feel. Change them before you change the file:
   - minDuration (default 1.6): Shortest the count can take, in seconds, even when everything has already loaded, so it doesn't flash past on a fast connection. The whole intro runs about 1.3 seconds longer.
   - maxDuration (default 4): Longest it waits for the fonts, the images and the page's images in view, in seconds, before landing anyway. While it waits, the count creeps on its own, so it never sits at 99.
   - growDuration (default 0.9): How long the last image, or the mark, takes to grow into its place on the page, in seconds. The loader's background clears over the end of it.
   - riseDuration (default 0.9): How long each line takes to rise into place after the handoff, in seconds.
   - stagger (default 0.07): Seconds between lines as they rise, in reading order.

4. Don't change, in components/ui/intro-loader.tsx:
   - Everything that moves is a Web Animation of a transform, a clip-path or an opacity; the only script that runs each frame is the count, so it stays smooth while React hydrates.
   - `introLoader` runs as an inline <script> serialized with toString(), so it stays self-contained: no outer variables, no imports, no async or object spread. It reads its timing from the plan's `t`, never from TIMING directly.
   - The last image is laid out at the target's size from the start, then scaled down and masked to the frame, so the handoff only undoes that and lands on the target pixel for pixel.
   - Order: count to 100 with the flipbook, the counter leaves, a breath, the handoff grows into the target as the background clears, then lines rise a stagger apart in reading order.
   - Reduced motion shows no loader, only a quick crossfade into the page after `fade.delay`.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/intro-loader.md

Wordmark

No images. The wordmark rises a letter at a time as the count runs, then shrinks and flies into the logo's spot in the header. The target can be anything.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Intro Loader: A page-load intro that counts to 100 with the real loading while a flipbook of your work plays in a small frame, then grows the last image into its place on the page. It doesn't fade out: its last frame is the page's first.
This demo, Wordmark: No images. The wordmark rises a letter at a time as the count runs, then shrinks and flies into the logo's spot in the header. The target can be anything.

1. Install it:
   npx shadcn@latest add @keyframeui/intro-loader-wordmark-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/intro-loader-wordmark-demo.json instead.)
   It adds the demo, components/intro-loader-wordmark-demo.tsx, and the component, components/ui/intro-loader.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <IntroLoader> on its own.

3. These props set its feel. Change them before you change the file:
   - minDuration (default 1.6): Shortest the count can take, in seconds, even when everything has already loaded, so it doesn't flash past on a fast connection. The whole intro runs about 1.3 seconds longer.
   - maxDuration (default 4): Longest it waits for the fonts, the images and the page's images in view, in seconds, before landing anyway. While it waits, the count creeps on its own, so it never sits at 99.
   - growDuration (default 0.9): How long the last image, or the mark, takes to grow into its place on the page, in seconds. The loader's background clears over the end of it.
   - riseDuration (default 0.9): How long each line takes to rise into place after the handoff, in seconds.
   - stagger (default 0.07): Seconds between lines as they rise, in reading order.

4. Don't change, in components/ui/intro-loader.tsx:
   - Everything that moves is a Web Animation of a transform, a clip-path or an opacity; the only script that runs each frame is the count, so it stays smooth while React hydrates.
   - `introLoader` runs as an inline <script> serialized with toString(), so it stays self-contained: no outer variables, no imports, no async or object spread. It reads its timing from the plan's `t`, never from TIMING directly.
   - The last image is laid out at the target's size from the start, then scaled down and masked to the frame, so the handoff only undoes that and lands on the target pixel for pixel.
   - Order: count to 100 with the flipbook, the counter leaves, a breath, the handoff grows into the target as the background clears, then lines rise a stagger apart in reading order.
   - Reduced motion shows no loader, only a quick crossfade into the page after `fade.delay`.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/intro-loader.md

Props

children

TypeReact.ReactNode

The page, rendered underneath the whole time. Wrap where the last image lands in IntroLoaderTarget, and the lines that rise in after the handoff in IntroLoaderLine (from="above" drops them in, for a nav). useIntroDone() turns true at the handoff, for anything that makes its own entrance.

images

Typestring[]

The flipbook, in order. Each wipes up over the last, a little sooner each time. The last one lands on the target, so make it the image the target shows, at the same address. Four or more good images read best.

mark

TypeReact.ReactNode

Instead of images: a mark that rises letter by letter with the count and flies onto the target, like a wordmark landing in the nav. Set it in the same type as the target. A string is split into letters, kerned as the whole word; anything else rises whole.

brand

TypeReact.ReactNode

Your name or logo, in the loader's top-left corner. It stays put through the handoff, so set it like the logo on the page and in the same spot, and the page's logo takes its place.

counter

Type"bottom-left" | "bottom-right" | "top-left" | "top-right" | falseDefault"bottom-left"

The corner the number sits in, or false for none. The digits are fixed-width and each rolls into place; at 100 the number slides up out of view.

label

TypeReact.ReactNode

Shown in place of the number, like a season. It rises in and leaves at 100 like the number does.

minDuration

TypenumberDefault1.6

Shortest the count can take, in seconds, even when everything has already loaded, so it doesn't flash past on a fast connection. The whole intro runs about 1.3 seconds longer.

maxDuration

TypenumberDefault4

Longest it waits for the fonts, the images and the page's images in view, in seconds, before landing anyway. While it waits, the count creeps on its own, so it never sits at 99.

growDuration

TypenumberDefault0.9

How long the last image, or the mark, takes to grow into its place on the page, in seconds. The loader's background clears over the end of it.

riseDuration

TypenumberDefault0.9

How long each line takes to rise into place after the handoff, in seconds.

stagger

TypenumberDefault0.07

Seconds between lines as they rise, in reading order.

once

TypebooleanDefaulttrue

Play once per browser session. Reloads, the back button and coming back to the page go straight to it. Arriving by a link to a section (/#work) always does.

storageKey

TypestringDefault"intro-loader"

The sessionStorage key that remembers it played.

skippable

TypebooleanDefaulttrue

A click or any key goes straight to the page. Modifier keys don't, so a screenshot shortcut doesn't skip the moment it's trying to catch.

onComplete

Type() => void

Called as the loader hands off to the page, or straight away when it's skipped.

contained

TypebooleanDefaultfalse

Cover this element instead of the screen, and leave the page's scroll alone. It starts once it's on screen. For a single section, or a preview like the ones here.

overlayClassName

Typestring

Classes for the loader, such as its padding, font and color. Its background is the page's own by default, read from the nearest background behind it, so nothing shows a seam at the handoff.

counterClassName

Typestring

Classes for the number or label, such as its size and font.

frameClassName

TypestringDefault"aspect-[4/5] rounded-sm"

Classes for the center frame the images play in: its width, aspect ratio and corners.

markClassName

Typestring

Classes for the mark, such as its font, weight and size. Match the target's.

className

Typestring

Classes for the element that wraps the page. Other props pass through to it. With reduced motion, there's no loader: the page crossfades in.

nonce

Typestring

Your Content Security Policy's nonce, for the small inline script that puts the loader up before the page is drawn. If the script is blocked, the loader is skipped.