Spinner Ring

The classic border spinner. One div, no SVG.

Tailwind CSS
<div class="w-10 h-10 rounded-full border-4 border-slate-200 border-t-indigo-600 animate-spin" role="status" aria-label="Loading"></div>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Small

Compact size for inline loading inside buttons and inputs.

Tailwind CSS

Large emerald

Large thick ring for full page or section loading states.

Tailwind CSS

Rose

Rose tone with a soft track for warm branded interfaces.

Tailwind CSS

About this spinner ring

The border spinner is the loading indicator everyone recognizes: a ring with one colored segment rotating endlessly. It is one div, no SVG, no JavaScript. The border-t-indigo-600 colors just the top segment while the rest stays light gray, and animate-spin rotates it.

This css spinner is the default choice for button loading states, inline content loading, and anywhere you need a compact indicator. At 40px it reads clearly without dominating.

Always pair spinners with accessible labels (role=status, aria-label). A silent spinning div tells screen reader users nothing. And for operations over 10 seconds, upgrade to a progress bar with percentage.

Every interface waits on things it cannot measure: a network round trip, a server job with no progress events. During those seconds, a frozen screen reads as a broken screen, and users start clicking again or leaving. The spinner's job is not to inform but to reassure: one rotating ring is the cheapest possible way to say the app is alive and working on it, which is why it became the universal loading glyph.

A single div with rounded-full, border-4 border-slate-200 forming the track, and border-t-indigo-600 coloring just the top segment. Tailwind's animate-spin rotates it, and because only one side differs in color, the rotation reads as motion. At w-10 h-10 it is big enough to notice and small enough to sit inline next to text or inside buttons.

Thicken to border-[6px] for hero-level spinners that must read from a distance, or slim to border-2 for inline text spinners. Calm it down with [animation-duration:1.2s] for background tasks, keep the default 1s for waits the user triggered. For a floating arc look, make the track transparent instead of slate-200 so only the colored segment exists.

The mistake is dropping the spinner into the layout with no reserved space. When it appears, surrounding content jumps aside; when it disappears, everything snaps back. That double layout shift feels more broken than the wait itself. Wrap the spinner's slot in a fixed-height container before the async work starts, so the layout is already correct when the spinner arrives and when it leaves.

Where to use it

  • ✓ Button loading states
  • ✓ Inline content loading
  • ✓ Form submission feedback
  • ✓ Card refresh indicators

Customization tips

Size with w-6/h-6 for inline or w-12/h-12 for prominent. Change the colored segment with border-t-{color}. Slow the spin with [animation-duration:1.5s] if it feels frantic.

Design notes

When to use

Use it for short, indeterminate waits: button loading states, inline content refreshes, and form submission feedback. The rotating ring is instantly recognized, and at small sizes it communicates activity without dominating the layout. It is the right default when you cannot measure progress.

What to avoid

Do not use it for operations longer than about ten seconds. An endless spinner with no progress info frustrates users; switch to a progress bar with a percentage for long tasks. Do not leave it spinning silently with no accessible label.

Accessibility

Include role=status and an aria-label so screen readers announce the loading state. Honor prefers-reduced-motion by swapping the spin for a static indicator or text.

Frequently asked questions

How do I make a CSS spinner?

Create a div with rounded-full, a light border all around, one colored border segment (border-t-indigo-600), and animate-spin. One div, no SVG needed.

Spinner vs progress bar?

Spinners for indeterminate waits under 10 seconds. Progress bars when you can measure completion or waits are longer.

How do I show loading in a button?

Replace the button label with a small spinner (w-4) plus 'Loading...' text, and disable the button to prevent double-submits.

How do I change the spinner speed in Tailwind?

The spin uses animate-spin, which runs at 1 second per rotation. Add an arbitrary animation class like [animation-duration:0.6s] for a faster spin or 2s for a slower one. Faster feels urgent and slower feels calm, so match the speed to whatever is loading.

Why is my spinner not spinning?

The most common cause is a missing animation class or another transform utility fighting it. Check that animate-spin is actually applied and that no other class overrides the transform. Also confirm the spin keyframes exist in your Tailwind setup, since some stripped-down builds remove them.

How do I make a spinner smaller without breaking the ring?

Reduce the size and the border width together. A 24px spinner with a 2px border keeps the same proportions as a 48px spinner with a 4px border. If you only shrink the size, the border looks chunky. Use w-6 h-6 border-2 instead of w-12 h-12 border-4.

Customize it with our tools