Skip to content

Spinner

Download .md

A spinner shows that a short task is running, such as saving a form or loading a list.

  • Use it inside a button while its action runs, with the button disabled and its label in the present tense (“Menyimpan…”).
  • Use it for a short wait with a label beside it, such as “Memuat data rilis”.
  • Use a Skeleton when you know the shape of the content that is loading, and a Progress bar when you know how far the task has come.
React
Memuat data rilis
Vue
Memuat data rilis
12
  1. 1Track
  2. 2Spinning arc

A 16px Lucide Loader2 icon (size-4) turning with animate-spin, in the current text color.

There is one style. Change the size with a size-* class, such as size-6 for a page that is loading.

React Vue Flutter Type Default Use
aria-label aria-label label (Semantics) text Loading What is loading, such as “Menyimpan”.
className class SizedBox.square(dimension:) class size-4 The size.
import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
export default function SpinnerDemo() {
return (
<div className="flex flex-wrap items-center gap-6">
<Button disabled>
<Spinner aria-label="Menyimpan" />
Menyimpan…
</Button>
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<Spinner aria-label="Memuat data rilis" />
Memuat data rilis
</div>
</div>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/spinner.json
  • It has role="status"; give it an aria-label that says what is happening.
  • It keeps turning when prefers-reduced-motion is on: the turning is the only sign that the task is still running.
  • When the task ends, replace it with the result, such as a toast or the loaded list.