Orbit Ring Loader
A glowing dot orbiting a faint circular track for a loading state. Size and colors are customizable; reduced motion replaces rotation with a slow opacity breath.
import { cn } from "cn"
// Voice Orb's planet-14 colors; override the variables through style.
const PALETTE = {
"--ld-a": "oklch(0.62 0.19 38)",
"--ld-b": "oklch(0.55 0.19 32)",
}
const CSS = `@keyframes ld-spin{to{transform:rotate(360deg)}}
@keyframes ld-breathe{0%,100%{opacity:0.45}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){[data-slot="orbit-ring-loader"] *{animation:ld-breathe 2.5s ease-in-out infinite !important}}`
/**
* A glowing dot that orbits a faint circular track for a loading state.
* Recolor with `--ld-a` and `--ld-b` through `style`.
* Exposes a status labelled "Loading"; pass `aria-label` to change it.
* With reduced motion the spin becomes a slow opacity breath.
*/
function OrbitRingLoader({
size = 48,
className,
style,
...props
}: React.ComponentProps<"div"> & {
/** Width and height in px. */
size?: number
}) {
return (
<div
role="status"
aria-label="Loading"
className={cn("relative inline-block", className)}
style={
{
width: size,
height: size,
...PALETTE,
...style,
} as React.CSSProperties
}
data-slot="orbit-ring-loader"
{...props}
>
<style>{CSS}</style>
<i className="absolute inset-0 rounded-full border border-current/15" />
<i className="absolute inset-0 animate-[ld-spin_1.5s_linear_infinite]">
<i className="absolute top-0 left-1/2 size-2 -translate-x-1/2 rounded-full bg-(--ld-b) shadow-[0_0_10px_var(--ld-b),0_0_20px_var(--ld-a)]" />
</i>
</div>
)
}
export { OrbitRingLoader }
import { OrbitRingLoader } from "@/components/loader/orbit-ring-loader"
/** OrbitRingLoader at its default size and palette. */
export default function OrbitRingLoaderDemo() {
return <OrbitRingLoader />
}
Installation
npx shadcn@latest add @01orbital/orbit-ring-loaderUsage
import { OrbitRingLoader } from "@/components/loader/orbit-ring-loader"
/** OrbitRingLoader at its default size and palette. */
export default function OrbitRingLoaderDemo() {
return <OrbitRingLoader />
}This example installs with everything it uses:
npx shadcn@latest add @01orbital/orbit-ring-loader-demoAPI reference
A glowing dot that orbits a faint circular track for a loading state. Recolor with --ld-a and --ld-b through style. Exposes a status labelled "Loading"; pass aria-label to change it. With reduced motion the spin becomes a slow opacity breath.
Prop
Type
It also accepts the HTML attributes of the element it renders.
Dependencies
npm: cn. The CLI installs it for you.
Last updated on