Spinner
Shows that something is loading. It takes the current text color. Sizes: sm 12px, default 16px, lg 24px and xl 32px.
Installation
npx shadcn@latest add @sevenone/spinnerUsage
import { Spinner } from "@/components/ui/spinner"Examples
Sizes
<Spinner size="sm" />
<Spinner />
<Spinner size="lg" />
<Spinner size="xl" />Loading button
Keep the label and disable the button, so it is not sent twice.
<Button disabled>
<Spinner aria-hidden="true" role={undefined} aria-label={undefined} />
Please wait
</Button>Accessibility
- On its own it has role="status" and the label "Loading", so the change is announced.
- Inside a button with a text label, hide it from screen readers; the label already says what is going on.
- It turns slower when people ask for reduced motion.