Asterisk

No dependencies
Code format
React + Tailwind
import type { CSSProperties } from 'react';

const T = 1.8;

const css = `
  .loader-asterisk { --ink: light-dark(#373a40, #f1f2f3); display: inline-grid; place-items: center; font-size: 88px; width: 1em; height: 1em; }
  /* All three start as one line. They fan out to their own angle, then keep turning
     the same way until they meet again half a turn on, which looks like the start. */
  .loader-asterisk__bar { grid-area: 1 / 1; width: 0.86em; height: 0.1em; border-radius: 0.05em; background: var(--ink); animation: loader-asterisk-fan ${T}s infinite; }
  @keyframes loader-asterisk-fan {
    0% { rotate: 0deg; scale: 1 1; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
    42%, 56% { rotate: var(--a); scale: 0.88 1; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
    100% { rotate: 180deg; scale: 1 1; }
  }
  @media (prefers-reduced-motion: reduce) {
    .loader-asterisk__bar { animation: none; rotate: var(--a); scale: 0.88 1; }
  }
`;

export function Preview() {
  return (
    <>
      <style href="kit-loaders-asterisk" precedence="kit">
        {css}
      </style>
      <div className="loader-asterisk" role="status" aria-label="Loading">
        {[0, 60, 120].map((a) => (
          <span key={a} className="loader-asterisk__bar" style={{ '--a': `${a}deg` } as CSSProperties} aria-hidden="true" />
        ))}
      </div>
    </>
  );
}

Free to use in any project, commercial included. MIT-0, no attribution required. Licence

Install with shadcn

npx shadcn@latest add @movin/loader-asterisk
Source on GitHub

About this component

Three bars lying as one line fan out into a six-point star, then fold shut again as they keep turning.

Dependencies
None
Difficulty
Beginner
Triggers
continuous, loop, morph
Techniques
keyframes, css variables, 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 bars rest open as a star.

More loaders

See all
Blinds
Bowl
Bubble
Carousel