# Armature — Animated UI Component for React

> Orbiting icon rings around a fixed center slot. Compose Armature + ArmatureRing for a multi-radius orbital system with per-ring speed, direction, and an optional eccentric elliptical ring. Pure CSS, pause-on-hover.

- Page: https://crucibleui.com/components/utility/armature
- Category: [utility](https://crucibleui.com/components/utility)
- Tier: free (full source)
- Engine: css

## Install

```bash
npx shadcn@latest add @crucible/armature
```

Registry JSON: https://crucibleui.com/r/armature.json

Import from `@/components/crucible/armature`.

## Props (`ArmatureProps`)

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `center?` | `React.ReactNode` | — | Content pinned in the fixed center slot — logo, icon, avatar. |
| `children` | `React.ReactNode` | — | One or more `<ArmatureRing>` elements. |
| `pauseOnHover?` | `boolean` | `true` | Pause every ring (and its counter-rotating icons) while hovered. |
| `emberColor?` | `string` | `"#ffffff"` | Color of the soft light cast behind the center slot. |

Also accepts: `React.ComponentPropsWithoutRef<"div">`.

## Usage example

```tsx
import { Armature, ArmatureRing } from "@/components/crucible/armature";

function Badge({ glyph, color }: { glyph: string; color: string }) {
  return (
    <div
      className="flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-neutral-900 text-sm shadow-lg"
      style={{ color }}
    >
      {glyph}
    </div>
  );
}

export default function ArmatureDemo() {
  return (
    <div className="relative isolate flex h-full min-h-[360px] w-full items-center justify-center overflow-hidden rounded-xl bg-neutral-950">
      <div
        aria-hidden
        className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.035),transparent_70%)]"
      />
      <Armature
        className="relative z-10 h-72 w-72"
        center={
          <div className="flex h-12 w-12 items-center justify-center rounded-full bg-gradient-to-br from-neutral-100 to-neutral-400 text-lg text-neutral-900 shadow-[0_0_24px_rgba(255,255,255,0.35)]">
            ✦
          </div>
        }
      >
        <ArmatureRing radius={70} speed={14}>
          <Badge glyph="◆" color="#f5f5f5" />
          <Badge glyph="✦" color="#f5f5f5" />
          <Badge glyph="●" color="#f5f5f5" />
        </ArmatureRing>
        <ArmatureRing radius={115} speed={24} direction="ccw" eccentricity={0.6}>
          <Badge glyph="▲" color="#a3a3a3" />
          <Badge glyph="■" color="#a3a3a3" />
          <Badge glyph="◆" color="#a3a3a3" />
          <Badge glyph="●" color="#a3a3a3" />
        </ArmatureRing>
      </Armature>
      <p className="absolute bottom-6 z-10 text-sm text-neutral-500">Hover to pause the orbits.</p>
    </div>
  );
}
```

## Accessibility & performance

Honors `prefers-reduced-motion` with a designed static frame or fade (never a blank box) and passes `className` through.

## Source (`armature.tsx`)

```tsx
"use client";

import * as React from "react";

import { cn } from "@/lib/utils";

export interface ArmatureProps extends React.ComponentPropsWithoutRef<"div"> {
  /** Content pinned in the fixed center slot — logo, icon, avatar. */
  center?: React.ReactNode;
  /** One or more `<ArmatureRing>` elements. */
  children: React.ReactNode;
  /** Pause every ring (and its counter-rotating icons) while hovered. @default true */
  pauseOnHover?: boolean;
  /** Color of the soft light cast behind the center slot. @default "#ffffff" */
  emberColor?: string;
}

export interface ArmatureRingProps extends React.ComponentPropsWithoutRef<"div"> {
  /** Ring radius in px. */
  radius: number;
  /** Seconds per revolution. @default 20 */
  speed?: number;
  /** Spin direction. @default "cw" */
  direction?: "cw" | "ccw";
  /** Draw a hairline guide circle with a rotating brightened arc. @default true */
  showPath?: boolean;
  /** Icons/elements distributed evenly around the ring. */
  children: React.ReactNode;
  /** Squash factor (0–1) for a slightly elliptical, off-axis orbit. @default 0 */
  eccentricity?: number;
  /** Color of the guide circle / trailing arc. @default "#ffffff" */
  color?: string;
}

const KEYFRAMES = `
@keyframes crucible-armature-spin-cw { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes crucible-armature-spin-ccw { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes crucible-armature-counter-cw { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes crucible-armature-counter-ccw { from { transform: rotate(-360deg); } to { transform: rotate(0deg); } }
@keyframes crucible-armature-ember {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.12); }
}
[data-crucible="armature"][data-paused="true"] .armature-spin {
  /* !important: the spin animation is set as an inline style whose shorthand
     implies animation-play-state:running, and inline wins over a plain rule. */
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  [data-crucible="armature"] .armature-spin,
  [data-crucible="armature"] .armature-ember {
    animation: none !important;
  }
}
`;

/**
 * Armature — orbiting icon rings around a fixed center slot. Compose with
 * `<ArmatureRing>` for a multi-radius orbital system: each ring sets its own
 * radius, speed, and direction, and icons stay upright via a counter-rotation
 * so only their position orbits, not their orientation.
 *
 * Crucible signature: rings render as neutral hairline guide circles with a
 * rotating arc that brightens to white just behind the icons, a soft white
 * glow behind the center slot, and support for one ring set deliberately
 * eccentric (`eccentricity`) for a slightly elliptical orbit. Pure CSS —
 * pauses on hover and freezes orbits (and the center glow's breathing) to a
 * static, correctly-centered frame under reduced motion.
 */
export function Armature({
  center,
  children,
  pauseOnHover = true,
  emberColor = "#ffffff",
  className,
  onMouseEnter,
  onMouseLeave,
  ...props
}: ArmatureProps) {
  const [paused, setPaused] = React.useState(false);

  return (
    <div
      data-crucible="armature"
      data-paused={pauseOnHover && paused}
      className={cn("relative flex items-center justify-center", className)}
      onMouseEnter={(e) => {
        onMouseEnter?.(e);
        if (pauseOnHover) setPaused(true);
      }}
      onMouseLeave={(e) => {
        onMouseLeave?.(e);
        if (pauseOnHover) setPaused(false);
      }}
      {...props}
    >
      <style>{KEYFRAMES}</style>
      <span
        aria-hidden
        className="armature-ember pointer-events-none absolute top-1/2 left-1/2 h-24 w-24 rounded-full blur-2xl"
        style={{
          background: `radial-gradient(circle, ${emberColor}66, transparent 70%)`,
          // Resting pose (centered, mid-glow) for when the breath is disabled
          // under reduced motion; the running animation overrides both.
          transform: "translate(-50%, -50%)",
          opacity: 0.7,
          animation: "crucible-armature-ember 4s ease-in-out infinite",
        }}
      />
      {center && <div className="relative z-10 flex items-center justify-center">{center}</div>}
      {children}
    </div>
  );
}

/**
 * ArmatureRing — one orbit within an `<Armature>`. Must be a descendant of
 * `Armature` (it positions itself absolutely against the nearest positioned
 * ancestor, i.e. Armature's root).
 */
export function ArmatureRing({
  radius,
  speed = 20,
  direction = "cw",
  showPath = true,
  eccentricity = 0,
  color = "#ffffff",
  children,
  className,
  style,
  ...props
}: ArmatureRingProps) {
  const icons = React.Children.toArray(children);
  const size = radius * 2;
  const squash = 1 - Math.min(1, Math.max(0, eccentricity)) * 0.16;
  const tilt = Math.min(1, Math.max(0, eccentricity)) * 5;
  const spinAnimation = `crucible-armature-spin-${direction} ${speed}s linear infinite`;
  const counterAnimation = `crucible-armature-counter-${direction} ${speed}s linear infinite`;

  return (
    <div
      data-crucible="armature-ring"
      className={cn("pointer-events-none absolute top-1/2 left-1/2", className)}
      style={{
        width: size,
        height: size,
        transform: `translate(-50%, -50%) scale(1, ${squash}) rotate(${tilt}deg)`,
        ...style,
      }}
      {...props}
    >
      {showPath && (
        <div
          aria-hidden
          className="absolute inset-0 rounded-full"
          style={{ border: `1px solid ${color}`, opacity: 0.25 }}
        />
      )}
      {showPath && (
        <div
          aria-hidden
          className="armature-spin absolute inset-0 rounded-full"
          style={{
            background: `conic-gradient(from 0deg, transparent 0deg, transparent 290deg, ${color} 330deg, transparent 358deg)`,
            WebkitMask: "radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))",
            mask: "radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))",
            animation: spinAnimation,
          }}
        />
      )}
      <div className="armature-spin absolute inset-0" style={{ animation: spinAnimation }}>
        {icons.map((icon, i) => {
          const angle = (360 / icons.length) * i;
          return (
            <div
              key={i}
              className="absolute top-1/2 left-1/2"
              style={{ transform: `translate(-50%, -50%) rotate(${angle}deg) translate(${radius}px) rotate(-${angle}deg)` }}
            >
              <div className="armature-spin pointer-events-auto" style={{ animation: counterAnimation }}>
                {icon}
              </div>
            </div>
          );
        })}
      </div>
    </div>
  );
}
```
