Skip to content

Square Spinner

A copy-paste spinners component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

SpinnersHTMLCSSany framework

Copy into your project

HTML
<!-- Square Spinner -->
<div class="nuda-square-spinner" role="status" aria-label="Loading">
  <div class="nuda-square-spinner__shape"></div>
</div>
CSS
/* Square Spinner
   Square rotating while morphing between square and circle.
   Customize: --sq-spinner-color, --sq-spinner-size */

.nuda-square-spinner {
  --sq-spinner-color: #34d399;
  --sq-spinner-size: 28px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nuda-square-spinner__shape {
  width: var(--sq-spinner-size);
  height: var(--sq-spinner-size);
  background: var(--sq-spinner-color);
  animation: nuda-square-spin 1.8s ease-in-out infinite;
  will-change: transform, border-radius;
}

@keyframes nuda-square-spin {
  0%   { transform: rotate(0deg);   border-radius: 0; }
  25%  { transform: rotate(90deg);  border-radius: 50%; }
  50%  { transform: rotate(180deg); border-radius: 0; }
  75%  { transform: rotate(270deg); border-radius: 50%; }
  100% { transform: rotate(360deg); border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-square-spinner__shape {
    animation: none;
    border-radius: 4px;
    opacity: 0.7;
  }
}

How to use Square Spinner

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More spinners components

← Browse all NudaUI components