BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/patchui/spinner

Spinner

patchui/spinner
FreeComponent

patchui publishes no description for this item.

Install it

npx shadcn@latest add https://ui.hotfix.jobs/r/spinner.json

Source

registry/components/ui/spinner.tsxui.hotfix.jobs/r/spinner.json
1"use client";
2
3import { cva, type VariantProps } from "class-variance-authority";
4import type * as React from "react";
5import { cn } from "@/lib/utils";
6
7const spinnerVariants = cva(
8 "relative inline-flex shrink-0 items-center justify-center",
9 {
10 defaultVariants: { size: "md" },
11 variants: {
12 size: {
13 sm: "size-4",
14 md: "size-5",
15 lg: "size-6",
16 },
17 },
18 },
19);
20
21type SpinnerSize = NonNullable<VariantProps<typeof spinnerVariants>["size"]>;
22
23const strokePx: Record<SpinnerSize, number> = {
24 sm: 2.5,
25 md: 2.75,
26 lg: 3,
27};
28
29export interface SpinnerProps
30 extends React.ComponentProps<"span">,
31 VariantProps<typeof spinnerVariants> {
32 /** Accessible label. */
33 label?: string;
34}
35
36export function Spinner({
37 className,
38 size = "md",
39 label = "Loading",
40 ...props
41}: SpinnerProps): React.ReactElement {
42 const resolvedSize: SpinnerSize = size ?? "md";
43 const stroke = strokePx[resolvedSize];
44 const radius = (24 - stroke) / 2;
45 const circumference = 2 * Math.PI * radius;
46 const arc = circumference * 0.28;
47
48 return (
49 <span
50 role="status"
51 aria-label={label}
52 data-slot="spinner"
53 className={cn(spinnerVariants({ size }), className)}
54 {...props}
55 >
56 <svg
57 aria-hidden="true"
58 viewBox="0 0 24 24"
59 className={cn(
60 "size-full animate-spin motion-reduce:animate-none",
61 )}
62 >
63 <circle
64 cx="12"
65 cy="12"
66 r={radius}
67 fill="none"
68 stroke="currentColor"
69 strokeWidth={stroke}
70 className="opacity-20"
71 />
72 <circle
73 cx="12"
74 cy="12"
75 r={radius}
76 fill="none"
77 stroke="currentColor"
78 strokeWidth={stroke}
79 strokeLinecap="round"
80 strokeDasharray={`${arc} ${circumference}`}
81 />
82 </svg>
83 <span className="sr-only">{label}</span>
84 </span>
85 );
86}

What it pulls in

npm packages

  • class-variance-authority

Other registry items

  • https://ui.hotfix.jobs/r/tokens.json
  • https://ui.hotfix.jobs/r/utils.json

Files it writes

  • registry/components/ui/spinner.tsx

Facts

Registry
patchui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

ui.hotfix.jobs hotfix-jobs/patch-ui on GitHub Raw registry item This item as JSON

More from patchui

All 51 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionpatchuiComponentsFree2 deps
AvataravatarpatchuiComponentsFree3 deps
BadgebadgepatchuiComponentsFree2 deps
BreadcrumbbreadcrumbpatchuiComponentsFree1 dep
ButtonbuttonpatchuiComponentsFree2 deps
CalendarcalendarpatchuiComponentsFree1 dep
CardcardpatchuiComponentsFree1 dep
CheckboxcheckboxpatchuiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex