Spinner
<svg class="spinner" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>.spinner sizes the icon and spins it. The markup is your own SVG, so it matches whichever icon
set the rest of your interface uses.
<svg class="spinner" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>The class sets 16px. Override it with your own width and height, or a utility class if you build with Tailwind.
<svg class="spinner" style="width: 0.75rem; height: 0.75rem" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>
<svg class="spinner" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>
<svg class="spinner" style="width: 1.5rem; height: 1.5rem" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>In a button
Section titled “In a button”<button class="btn" disabled> <svg class="spinner" data-icon="inline-start" role="status" aria-label="Loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path> </svg> Saving</button>
<button class="btn btn-outline btn-icon" disabled aria-label="Loading"> <svg class="spinner" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M21 12a9 9 0 1 1-6.219-8.56"></path> </svg></button>Set dir="rtl" on the page or on any subtree — padding, corners and positions follow the reading
direction on their own. See the button page for a live example.
Accessibility
Section titled “Accessibility”role="status"announces politely, without interrupting what is being read.aria-label="Loading"names it. If visible text already says so, usearia-hidden="true"on the spinner instead, so it is not announced twice.- The animation stops under
prefers-reduced-motion, so it does not become a hazard.