Orbital loaders
Five orbiting loaders: a solar dot, a binary pair, a comet, a satellite and a nested gyro. Each is sized and token-driven.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/loaders-orbitalDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install motionCopy the source
components/ui/loaders-orbital.tsx"use client"
import type * as React from "react"
import { motion, useReducedMotion } from "motion/react"
import { cn } from "@/lib/utils"
/* Orbital loader family: 5 decorative indicators on an orbit and rotation theme. Colour comes ONLY from tokens (currentColor / bg-current). Size = the box scale (aligned with the base spinner). DELIBERATE: a loader's rotation is INFORMATION; it keeps turning under reduced-motion too (a stopped loader reads as "hung"). The delays and angles are fixed and index-derived, nothing random. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
const box: Record<StyledSize, string> = {
sm: "size-4",
md: "size-5",
lg: "size-6",
xl: "size-8",
}
type Props = React.ComponentProps<"div"> & { size?: StyledSize; label?: string }
/* Solar: a dot orbits around a central core. */
export function SolarLoader({ className, size = "md", label = "Loading", ...props }: Props) {
return (
<div
data-slot="styled-loader"
role="status"
aria-label={label}
className={cn("relative inline-block text-primary", box[size], className)}
{...props}
>
<span className="absolute inset-[35%] rounded-full bg-current" />
<motion.span
className="absolute inset-0"
animate={{ rotate: 360 }}
transition={{ duration: 1.4, ease: "linear", repeat: Infinity }}
>
<span className="absolute left-1/2 top-0 size-1/5 -translate-x-1/2 rounded-full bg-current" />
</motion.span>
</div>
)
}
/* Binary: iki nokta ortak merkez etrafinda 180 derece karsilikli doner. */
export function BinaryLoader({ className, size = "md", label = "Loading", ...props }: Props) {
return (
<div
data-slot="styled-loader"
role="status"
aria-label={label}
className={cn("relative inline-block text-info", box[size], className)}
{...props}
>
<motion.span
className="absolute inset-0"
animate={{ rotate: 360 }}
transition={{ duration: 1.1, ease: "linear", repeat: Infinity }}
>
<span className="absolute left-1/2 top-0 size-1/4 -translate-x-1/2 rounded-full bg-current" />
<span className="absolute bottom-0 left-1/2 size-1/5 -translate-x-1/2 rounded-full bg-current/60" />
</motion.span>
</div>
)
}
/* Comet: yorunge yapan nokta + sonuk kuculen kuyruk noktalari. */
export function CometLoader({ className, size = "md", label = "Loading", ...props }: Props) {
const tail = [0, 1, 2, 3]
return (
<div
data-slot="styled-loader"
role="status"
aria-label={label}
className={cn("relative inline-block text-brand", box[size], className)}
{...props}
>
{tail.map((i) => (
<motion.span
key={i}
className="absolute inset-0"
animate={{ rotate: 360 }}
transition={{ duration: 1.2, ease: "linear", repeat: Infinity, delay: i * -0.08 }}
>
<span
className="absolute left-1/2 top-0 -translate-x-1/2 rounded-full bg-current"
style={{
width: `${28 - i * 5}%`,
height: `${28 - i * 5}%`,
opacity: 1 - i * 0.22,
}}
/>
</motion.span>
))}
</div>
)
}
/* Satellite: ic halka bir yone, dis nokta ters yone doner. */
export function SatelliteLoader({ className, size = "md", label = "Loading", ...props }: Props) {
return (
<div
data-slot="styled-loader"
role="status"
aria-label={label}
className={cn("relative inline-block text-success", box[size], className)}
{...props}
>
<motion.span
className="absolute inset-[28%] rounded-full border-2 border-current/25 border-t-current"
animate={{ rotate: 360 }}
transition={{ duration: 1, ease: "linear", repeat: Infinity }}
/>
<motion.span
className="absolute inset-0"
animate={{ rotate: -360 }}
transition={{ duration: 1.6, ease: "linear", repeat: Infinity }}
>
<span className="absolute left-1/2 top-0 size-1/5 -translate-x-1/2 rounded-full bg-current" />
</motion.span>
</div>
)
}
/* Gyro: 3 nested rings rotate at different speeds/axes. */
export function GyroLoader({ className, size = "md", label = "Loading", ...props }: Props) {
const reduce = useReducedMotion()
return (
<div
data-slot="styled-loader"
role="status"
aria-label={label}
className={cn("relative inline-block text-primary", box[size], className)}
{...props}
>
<motion.span
className="absolute inset-0 rounded-full border-2 border-transparent border-t-current"
animate={{ rotate: 360 }}
transition={{ duration: 1.3, ease: "linear", repeat: Infinity }}
/>
<motion.span
className="absolute inset-[22%] rounded-full border-2 border-transparent border-b-current/70"
animate={{ rotate: reduce ? 360 : -360 }}
transition={{ duration: 1, ease: "linear", repeat: Infinity }}
/>
<motion.span
className="absolute inset-[44%] rounded-full border-2 border-transparent border-l-current/50"
animate={{ rotate: 360 }}
transition={{ duration: 0.8, ease: "linear", repeat: Infinity }}
/>
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Solar
A dot orbits a token core.
import { SolarLoader } from "@/components/ui/loaders-orbital"
<SolarLoader />Binary
Two dots orbit a shared center.
import { BinaryLoader } from "@/components/ui/loaders-orbital"
<BinaryLoader />Comet
An orbiting dot trails a fading tail.
import { CometLoader } from "@/components/ui/loaders-orbital"
<CometLoader />Satellite
An inner ring and outer dot counter-rotate.
import { SatelliteLoader } from "@/components/ui/loaders-orbital"
<SatelliteLoader />Gyro
Nested rings spin at different speeds.
import { GyroLoader } from "@/components/ui/loaders-orbital"
<GyroLoader />ai2 Orbital loaders: 5 styled variations on the token system
The ai2 Orbital loaders are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around orbiting loading indicators. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: framer-motion drives the orbits, counter-rotations and trails. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, the orbits keep turning on purpose, like the base Spinner, because a frozen loader reads as a hang.
What is in the ai2 Orbital loaders?
5 exports in one file: Solar, Binary, Comet, Satellite and Gyro. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: framer-motion drives the orbits, counter-rotations and trails.
- Reduced-motion aware: Under prefers-reduced-motion, the orbits keep turning on purpose, like the base Spinner, because a frozen loader reads as a hang.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Orbital loaders sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.