How it works
This loading spinner is the circle loader most people picture when they think of a CSS spinner: a thin, faint ring with one bright quarter that turns at a steady speed. It is a single element. The div gets a border in your color at 18% opacity, then border-top-color overrides one side with the full color, and border-radius: 50% bends the four sides into a ring. A keyframe called spin rotates it from 0 to 360 degrees on an infinite loop.
Because nothing but the box itself is involved, it drops into a button, a table cell or the middle of an empty panel without extra markup. Use it for waits you cannot measure, like a fetch that usually finishes in under two seconds. For longer or measurable work a progress bar tells the user more.
The parameters are Size (16 to 160px), Thickness, Color, Duration and Easing. Keep Thickness around a tenth of Size: 4px on a 48px ring reads well, while 2px on a 24px inline spinner keeps it delicate. Leave Easing on linear; ease-in-out makes the arc look like it stalls once per turn. A Duration of 0.7 to 1s feels responsive without looking frantic.
The exported markup carries role="status" and aria-label="Loading", so assistive tech announces it. Only transform is animated, which the browser hands to the compositor, so the ring keeps turning even while the main thread is busy parsing the response you are waiting for.
How do I change the spinner speed?
Change Duration. It is the time for one full 360 degree turn, so 0.9s (the default) means just over one rotation per second. Lower values spin faster. In the exported CSS it is the second value in the animation shorthand on the spinner class, and in the React version it is the duration field of the transition object, so you can also edit it by hand later.
Why does the ring use border-top-color instead of a conic gradient?
Borders work in every browser, need no masking tricks and stay crisp at any size. The full border draws the faint track, and border-top-color paints one of the four sides in the strong color. Because the corners are rounded to 50%, that side becomes a quarter arc. A conic gradient can give a tapered tail, but it needs a mask to cut out the middle.
Can I make the spinner inherit the text color?
Yes. In the copied CSS replace the color value with currentColor for border-top-color, and use a translucent version of it for the track, for example color-mix(in srgb, currentColor 18%, transparent). The spinner then matches whatever text color its parent has, which is handy inside buttons and links that change color on hover.