Skip to content

Full-Page Loader

Tailwind CSS full-page loader overlay with a spinning gradient ring, progress bar and status messages that fades out once the page has loaded.

Also known as: page loader, loading overlay, page preloader animation, full screen loading screen, loading spinner overlay

Full-Page Loader live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A full-page loader built with Tailwind CSS and a small vanilla JavaScript controller. A dark violet overlay with a spinning gradient ring, a progress bar and rotating status messages covers the page until it has finished loading, then fades away and hands focus to the main content. Use it for dashboards, single-page apps and any page that needs a moment before it is usable.

How it works

The root is .tpl-root. It holds the .tpl-overlay (marked data-tpl-overlay), a visually hidden live region marked data-tpl-status, and the page itself inside data-tpl-content. The overlay is fixed inset-0 z-50, so it sits above everything. Inside it are two .tpl-ring SVGs that rotate in opposite directions, the breathing .tpl-mark logo tile, a role="progressbar" track and the data-tpl-bar fill.

On DOMContentLoaded the script adds tpl-js to the root, marks the content aria-busy and inert, and starts a timer that eases the progress value toward 90% while cycling the texts in the MESSAGES array. When the page fires load and at least data-tpl-min-duration milliseconds have passed, the bar jumps to 100%, .tpl-overlay--done fades the overlay out, the content becomes interactive again and focus moves to the data-tpl-focus element. The Replay loader button (data-tpl-replay) runs the sequence again.

Without JavaScript the tpl-failsafe animation in style.css hides the overlay after 10 seconds, so the page is never locked behind it.

Customization

  • data-tpl-min-duration on .tpl-root: minimum time in milliseconds the loader stays visible; set 0 to hide it as soon as the page is ready.
  • data-tpl-wait="event" on .tpl-root: keep the loader until you call root.dispatchEvent(new CustomEvent('tpl:ready')), for example after your fetch() resolves.
  • --tpl-bg on .tpl-overlay in style.css: change the base color behind the two radial glows.
  • --tpl-fade on .tpl-overlay: make the fade-out faster or slower.
  • MESSAGES at the top of script.js: replace or translate the rotating status texts.
  • from-violet-400 to-fuchsia-400 on data-tpl-bar and the stops in #tpl-ring-gradient: swap them for your brand colors.
  • Replace the hexagon SVG inside .tpl-mark with your own logo.

Use cases

  • Dashboards: cover the page with a spinner and progress bar until data is ready
  • Single-page apps: rotating status messages tell users what is loading
  • Heavy landing pages: the overlay fades out after load and moves focus to the main content
  • Web tools: a dark violet gradient ring gives a branded first impression

Accessibility

The progress track uses role="progressbar" with aria-label, aria-valuemin, aria-valuemax and an aria-valuenow updated on every tick. The decorative rings and rotating text are aria-hidden; screen readers hear only "Loading page" and "Page loaded" from the polite role="status" region. While loading, the content is inert and aria-busy="true", so keyboard focus cannot reach hidden controls, and afterwards focus moves to the main element. Under prefers-reduced-motion: reduce the rings stop spinning and the transitions are removed.

Usage notes

Place the markup as the first element in body so the overlay is painted before the rest of the page. Use one loader per page; the gradient id inside the SVG must stay unique.

Full-Page Loader at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile, dark design
Category
Loaders & Spinners
License
Free for personal and commercial use

Questions about this template

Can I use the Full-Page Loader code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Full-Page Loader – free Tailwind CSS loader & spinner template
Full-Page Loader · free Tailwind CSS loader & spinner template

More Loaders & Spinners

Pulse Ring Loader – free Pure CSS loader & spinner template

Pulse Ring Loader

Pure CSS loading animation with concentric rings expanding from a beating dot, in default, large and inline sizes with custom properties and reduced motion.

Bouncing Dots Loader – free Pure CSS loader & spinner template

Bouncing Dots Loader

Pure CSS three-dot loaders: bounce, pulse with rings, chat typing indicator and a button loading state, all driven by custom properties.

CSS Spinner Collection – free Pure CSS loader & spinner template

CSS Spinner Collection

Eight lightweight pure CSS loading spinners in a labelled grid, each with role="status" and screen reader text, no JavaScript.

Button and Inline Loaders – free Tailwind CSS loader & spinner template

Button and Inline Loaders

Tailwind CSS loading states for buttons, inputs and inline text: ring and arc spinners, bouncing dots, a progress line and a deploy status pill.