Preview
Switch between light and dark to inspect the embedded Storybook preview.
Installation
pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/spinner.jsonStorybook
Explore all variants, controls, and accessibility checks in the interactive Storybook playground.
View in StorybookCode
import { cn } from "../../lib/utils";
export type SpinnerProps = {
size?: "lg" | "md" | "sm";
} & React.HTMLAttributes<HTMLDivElement>;
function Spinner({ className, size = "md", ...props }: SpinnerProps) {
return (
<div
className={cn(
"animate-spin rounded-full border-2 border-current border-t-transparent",
{
"size-4": size === "sm",
"size-6": size === "md",
"size-8": size === "lg",
},
className,
)}
{...props}
>
<span className="sr-only">Loading…</span>
</div>
);
}
export { Spinner };