antlitz
Menu

Spinner

An indeterminate loading indicator.

import { Spinner } from "antlitz";

API

PropTypeDefault
asElementTypesvg
sizestring | number24
variant"stroke" | "fill" | "plain"stroke

Spinner is an Icon, so it takes the same props — size is a number in pixels, not a variant name.

It carries role="status" and aria-label="Loading" by default. Override the label when something more specific helps: aria-label="Uploading photo".

Sizes

export function Sizes() {
  return (
    <>
      <Spinner size={16} />
      <Spinner size={24} />
      <Spinner size={32} />
    </>
  );
}

In context

export function InContext() {
  return (
    <>
      <Button loading>Saving</Button>
      <Button variant="outline" size="icon" aria-label="Loading" loading />
      <Spinner size={20} className="text-foreground-subtle" />
    </>
  );
}

Button renders one for you when loading is set, so a spinner rarely needs placing by hand inside a button.

Reduced motion

The spinner is deliberately not gated behind motion-safe. A frozen loading indicator conveys nothing, which is worse for the user it was meant to protect than a moving one.