Build a Loading State Kit with Spinners, Skeleton Shimmer and Progress Bars in One HTML File

Generates one self-contained HTML page with CSS spinners, skeleton shimmer placeholders, determinate and indeterminate progress bars, and a guide for picking each by expected wait time. Respects reduced motion.

You getThe complete HTML in a single code block, A short table and risks and next actions

The prompt

Prompt
Role: You are a senior front-end engineer who specializes in CSS motion and perceived performance.Context: I am building Trailhead, a hiking route planner (example value for {product_name}) and need a loading-state kit for a route search results list with map preview cards (example value for {screen_context}). The job to be done is to decide which loading pattern to use for each expected wait time so users never stare at a blank area.

Inputs:
- Product: Trailhead, a hiking route planner (example value for {product_name})
- Screen: a route search results list with map preview cards (example value for {screen_context})
- Brand color: #2F7D5B (example value for {brand_color})
- Color scheme: light with a dark mode toggle (example value for {color_scheme})
If any input is missing, list your assumptions in a separate Assumptions section before the code.

Task: Build ONE self-contained HTML file with inline CSS and minimal vanilla JS. No libraries, no external assets, no network requests.

Workflow:
1. Create three spinners (ring, dots, bars) using only transform and opacity animations.
2. Create a skeleton shimmer for a card, a list row and a text block, using a moving gradient on a pseudo-element.
3. Create an indeterminate progress bar and a determinate one driven by a Start button that simulates progress.
4. Add a 'Choose a pattern' table: under 1s = no indicator, 1-3s = spinner, 3-10s = skeleton, over 10s = determinate progress with text.
5. Add a 'Simulate load' button that swaps the skeleton for real content after 2.5 seconds, with a fade-in and no layout shift.

Constraints:
- Use CSS custom properties for color, size and speed.
- Add role='status' and aria-busy where content loads, plus visually hidden text for screen readers.
- Under prefers-reduced-motion, replace shimmer and spin with a gentle opacity pulse.
- Keep the file under 350 lines and readable.
- Do not claim performance numbers you did not measure.

Output format:
1. Assumptions (bullets)
2. The complete HTML in a single code block
3. A short table: pattern, best use, wait-time range, accessibility note
4. Risks and next actions (3-5 bullets, for example testing on slow devices, swapping in real data)

Acceptance criteria:
- All patterns animate on open without a click, except the simulated ones.
- Swapping skeleton to content causes no visible layout jump.
- Keyboard users can reach every button, and focus is visible.
- The page works offline when saved as a file.

Quality checks: Before replying, verify that only transform and opacity animate where possible, that every {variable} was applied, that reduced motion is handled, and that the code has no external URLs. Tool note: in Claude, deliver it as a single HTML artifact; in ChatGPT, use one code block and no extra files; in Cursor, create index.html and do not add a build step.

Dashed parts are example values, so the prompt runs as copied. Change them in Fill in the blanks.

Paste as is after filling the variables. If the skeleton shapes do not match your real layout, ask a follow-up with your actual card structure. Test the result with browser CPU throttling before shipping.

Make it repeatable

Keep using this prompt without pasting it in every time.

Keep exploring

More in Animations & Effects