Spinner

A spinning ring for a wait of unknown length.

Usage

tsx
<Spinner />

Size and colour

It is 1rem and takes the text colour. Change both with className.

tsx
<Spinner className="size-6" />
<Spinner className="size-8 text-primary" />

In a button

tsx
<Button clickable={!isSaving} onClick={save}>
  <Button.IconLabel
    icon={
      <Button.Icon>
        <Swap.Boolean swapOn={isSaving} components={[<MdSave />, <Spinner />]} />
      </Button.Icon>
    }
    label={<Button.Label>{isSaving ? "saving" : "save"}</Button.Label>}
  />
</Button>

What it announces

It is a status, named "Loading" unless you pass a label.

tsx
<Spinner label="Loading invoices" />

Reference

proptypedefault
as?ElementType"span"the element or component to render
label?string"Loading"what screen readers announce
className?string—added after the component's own class: what you set wins
…restprops of as—typed against the chosen element