Examples
Local loading status
Use the spinner beside or inside the content that is waiting.
Three spinner sizes with screen-reader status text
import { Spinner } from "@phuctech/ui/components/spinner";
export function Example() {
return (
<div className="flex items-center gap-6">
<Spinner size="sm" label="Loading a preview" />
<Spinner label="Loading a report" />
<Spinner size="lg" label="Loading workspace data" />
</div>
);
}
Bounded overlay
Overlay mode covers a positioned parent; its content remains in the document and scrolls only when the parent requires it.
Spinner overlay in a positioned content surface
import { Spinner } from "@phuctech/ui/components/spinner";
export function Example() {
return <div className="relative min-h-28"><Spinner overlay label="Loading report" /></div>;
}Try the props
Compare the shared icon sizes and optional parent overlay.
Spinner property playground
import { Spinner } from "@phuctech/ui/components/spinner";
export function Example() {
return <Spinner size="md" label="Loading report" />;
}When to use
Use Spinner when work is underway but its completion amount is not useful or known. Use Progress when the completed amount can be measured. Overlay mode is bounded to a positioned parent and does not perform any data work.
Usage
import { Spinner } from "@phuctech/ui/components/spinner";
<Spinner label="Loading report" />API
Tokens
Accessibility
- The root has a polite
statusrole and includes a screen-reader label. - Reduced-motion users receive a static indicator with the same status text.
Do and don’t
Place the indicator beside the affected task and explain its status.
Use Spinner to estimate completion or to cover an unbounded page.