Theme
Customize appearance
Components
Spinner
Indicate that an operation is still running.
View component source ↗Preview
A minimal example to get started.
Loading your workspace…
Installation
Install this component and its dependencies in a project initialized with shadcn.
pnpm dlx shadcn@latest add https://ui.hyunjoon.net/r/spinner.jsonUsage
This is the basic example. Use the Code tab above for the selected example. Adjust import aliases to match your project.
import { Spinner } from "@/components/ui/spinner";
export default function Example() {
return (
<div className="flex items-center gap-2 text-sm">
<Spinner />
Loading your workspace…
</div>
);
}
API reference
Derived from the installed component types. Native DOM props are also supported where applicable. A dash means no explicit default is documented. Some props depend on the selected mode.
Spinner
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
max | string | number | undefinedstring | number | undefined | — | Maximum allowed value. |
min | string | number | undefinedstring | number | undefined | — | Minimum allowed value. |
name | string | undefinedstring | undefined | — | Field name used in form data. |
target | string | undefinedstring | undefined | — | Browsing context in which the link opens. |
type | string | undefinedstring | undefined | — | The native input or button behavior. |
href | string | undefinedstring | undefined | — | Destination URL for the link. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<SVGSVGElement> | undefinedReact.FocusEventHandler<SVGSVGElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<SVGSVGElement> | undefinedReact.FocusEventHandler<SVGSVGElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<SVGSVGElement, Element> | undefinedReact.ChangeEventHandler<SVGSVGElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<SVGSVGElement> | undefinedReact.KeyboardEventHandler<SVGSVGElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<SVGSVGElement> | undefinedReact.MouseEventHandler<SVGSVGElement> | undefined | — | Called when the element is activated. |
ref | React.Ref<SVGSVGElement> | undefinedReact.Ref<SVGSVGElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
Usage notes
Pair it with short status text when the reason for waiting is not obvious. Avoid hiding an actionable error behind indefinite loading.