spiral
loading-ui/spiralFreeComponent
@loading-ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by @loading-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://loading-ui.com/r/spiral.jsonSource
1"use client";23import { motion } from "motion/react";4import { cn } from "@/lib/utils";56function Spiral({7 dots = 8,8 radius = 31.25,9 className,10 ...props11}: React.ComponentProps<"span"> & { dots?: number; radius?: number }) {12 return (13 <span14 role="status"15 className={cn("relative inline-block", className)}16 {...props}17 >18 {Array.from({ length: dots }, (_, index) => {19 const angle = (index / dots) * (2 * Math.PI);20 const x = `${50 + radius * Math.cos(angle)}%`;21 const y = `${50 + radius * Math.sin(angle)}%`;2223 return (24 <motion.span25 key={index}26 aria-hidden="true"27 className="absolute inline-block rounded-full bg-current"28 style={{29 left: x,30 top: y,31 translate: "-50% -50%",32 width: `${150 / dots}%`,33 height: `${150 / dots}%`,34 }}35 animate={{36 scale: [0, 1, 0],37 opacity: [0, 1, 0],38 }}39 transition={{40 duration: 1.5,41 repeat: Infinity,42 delay: (index / dots) * 1.5,43 ease: "easeInOut",44 }}45 />46 );47 })}48 <span className="sr-only">Loading</span>49 </span>50 );51}5253export { Spiral };
What it pulls in
npm packages
Files it writes
More from @loading-ui
All 50 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordion-loaderaccordion-loader | @loading-ui | Components | Free | no deps | |
| analyzing-imageanalyzing-image | @loading-ui | Components | Free | 1 dep | |
| arcarc | @loading-ui | Components | Free | no deps | |
| barsbars | @loading-ui | Components | Free | no deps | |
| bobbing-dotsbobbing-dots | @loading-ui | Components | Free | 1 dep | |
| bouncing-dotsbouncing-dots | @loading-ui | Components | Free | no deps | |
| classicclassic | @loading-ui | Components | Free | no deps | |
| clock-ringclock-ring | @loading-ui | Components | Free | no deps |
