Twist
React + Tailwind
import type { CSSProperties } from 'react';
const T = 1.9;
const SQUARES = 5;
const css = `
.loader-twist { --ink: light-dark(#373a40, #f1f2f3); display: inline-grid; place-items: center; font-size: 88px; width: 1em; height: 1em; }
/* Each square waits a beat longer than the one outside it, so the quarter turn winds inward. */
.loader-twist__square { grid-area: 1 / 1; width: var(--s); height: var(--s); box-sizing: border-box; border: 0.045em solid var(--ink); border-radius: 22%; opacity: var(--o); animation: loader-twist-turn ${T}s infinite; animation-delay: var(--d); }
@keyframes loader-twist-turn {
0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.7, 0, 0.3, 1); }
52%, 100% { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
.loader-twist__square { animation: none; transform: rotate(calc(var(--i) * 9deg)); }
}
`;
export function Preview() {
return (
<>
<style href="kit-loaders-twist" precedence="kit">
{css}
</style>
<div className="loader-twist" role="status" aria-label="Loading">
{Array.from({ length: SQUARES }, (_, i) => (
<span
key={i}
className="loader-twist__square"
style={{ '--s': `${(1 - i * 0.19).toFixed(2)}em`, '--o': (1 - i * 0.16).toFixed(2), '--d': `${(i * 0.075).toFixed(3)}s`, '--i': i } as CSSProperties}
aria-hidden="true"
/>
))}
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
HTML
<div class="loader-twist" role="status" aria-label="Loading">
<span class="loader-twist__square" style="--s:1.00em;--o:1.00;--d:0.000s;--i:0" aria-hidden="true"></span>
<span class="loader-twist__square" style="--s:0.81em;--o:0.84;--d:0.075s;--i:1" aria-hidden="true"></span>
<span class="loader-twist__square" style="--s:0.62em;--o:0.68;--d:0.150s;--i:2" aria-hidden="true"></span>
<span class="loader-twist__square" style="--s:0.43em;--o:0.52;--d:0.225s;--i:3" aria-hidden="true"></span>
<span class="loader-twist__square" style="--s:0.24em;--o:0.36;--d:0.300s;--i:4" aria-hidden="true"></span>
</div>CSS
.loader-twist { --ink: light-dark(#373a40, #f1f2f3); display: inline-grid; place-items: center; font-size: 88px; width: 1em; height: 1em; }
/* Each square waits a beat longer than the one outside it, so the quarter turn winds inward. */
.loader-twist__square { grid-area: 1 / 1; width: var(--s); height: var(--s); box-sizing: border-box; border: 0.045em solid var(--ink); border-radius: 22%; opacity: var(--o); animation: loader-twist-turn 1.9s infinite; animation-delay: var(--d); }
@keyframes loader-twist-turn {
0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.7, 0, 0.3, 1); }
52%, 100% { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
.loader-twist__square { animation: none; transform: rotate(calc(var(--i) * 9deg)); }
}Goal: Create a "Twist" loader.
Visual behavior: Five nested squares turn a quarter one after another, so the stack winds into a spiral and straightens out again.
Technique:
- Pure CSS: every motion is a keyframe animation, so the plain HTML version needs no script.
- Everything is sized in em from one font-size on the root, so changing that one value scales the whole loader.
- Every square runs the same quarter turn. Each starts a beat after the one outside it, so the turn winds inward into a spiral.
- A quarter turn leaves a square looking exactly as it started, so the loop never jumps.
- Inner squares are fainter, which keeps the spiral readable at small sizes.
Accessibility: The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the squares rest slightly turned against each other, as a still spiral.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: neutral only. Black, white and grays, no hues. Use the color values above as written, or my project's closest neutral tokens.
Return a single self-contained component. No dependencies.Goal: Create a "Twist" loader.
Visual behavior: Five nested squares turn a quarter one after another, so the stack winds into a spiral and straightens out again.
Technique:
- Pure CSS: every motion is a keyframe animation, so the plain HTML version needs no script.
- Everything is sized in em from one font-size on the root, so changing that one value scales the whole loader.
- Every square runs the same quarter turn. Each starts a beat after the one outside it, so the turn winds inward into a spiral.
- A quarter turn leaves a square looking exactly as it started, so the loop never jumps.
- Inner squares are fainter, which keeps the spiral readable at small sizes.
Accessibility: The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the squares rest slightly turned against each other, as a still spiral.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: use my project's existing color tokens. The color values above are grayscale placeholders. Map each one by its role (surface, text, border, accent, glow) to my theme, and keep their relative lightness so contrast and the effect still read.
Return a single self-contained component. No dependencies.Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Free to use in any project, commercial included. MIT-0, no attribution required. Licence
About this component
Five nested squares turn a quarter one after another, so the stack winds into a spiral and straightens out again.
- Dependencies
- None
- Difficulty
- Beginner
- Triggers
- continuous, loop, delay stagger
- Techniques
- keyframes, transition delay stagger, transform only
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the squares rest slightly turned against each other, as a still spiral.