# Filament — Animated Card for React

> An animated conic-gradient border — a white-hot filament head trailing a cool silver-blue tail that desaturates and fades to a faint slate trace. Pure CSS @property animation, zero JS, zero dependencies.

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

## Install

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

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

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

## Props (`FilamentProps`)

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `React.ReactNode` | — | Card content. |
| `colors?` | `[string, string, string, string]` | — | Four stops for the traveling filament: `[head, hot, cool, trace]` — a white-hot leading point, the bright silver it cools through, the cool blue-gray it desaturates to, and a faint slate trace before it fades. |
| `radius?` | `number` | — | Border radius in px. |
| `thickness?` | `number` | — | Ring thickness in px. |
| `duration?` | `number` | — | Seconds for one full lap. |
| `paused?` | `boolean` | — | Freeze the animation, holding the current frame. |

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

## Usage example

```tsx
import { Filament } from "@/components/crucible/filament";

const LABEL = "text-[10px] font-medium uppercase tracking-[0.2em] text-neutral-600";

export default function FilamentDemo() {
  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%)]"
      />
      <div className="relative z-10 flex flex-wrap items-center justify-center gap-10 p-6">
        <div className="flex flex-col items-center gap-3">
          <Filament className="w-72 p-6">
            <h3 className="text-lg font-semibold text-white">Animated border</h3>
            <p className="mt-2 text-sm text-neutral-400">
              Watch the edge — a bright head orbits the card, trailing a cool tail that fades out.
            </p>
          </Filament>
          <span className={LABEL}>Default</span>
        </div>
        <div className="flex flex-col items-center gap-3">
          <Filament
            colors={["#fff8ec", "#ffb166", "#e2584d", "#8b5cf6"]}
            duration={3.5}
            radius={24}
            className="w-56 p-6 text-center"
          >
            <p className="text-sm text-neutral-300">Any palette, any speed.</p>
          </Filament>
          <span className={LABEL}>Custom colors · 3.5s</span>
        </div>
      </div>
    </div>
  );
}
```

## Accessibility & performance

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

## Source (`filament.tsx`)

```tsx
import * as React from "react";

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

export interface FilamentProps extends React.ComponentPropsWithoutRef<"div"> {
  /** Card content. */
  children: React.ReactNode;
  /**
   * Four stops for the traveling filament: `[head, hot, cool, trace]` — a
   * white-hot leading point, the bright silver it cools through, the cool
   * blue-gray it desaturates to, and a faint slate trace before it fades.
   */
  colors?: [string, string, string, string];
  /** Border radius in px. */
  radius?: number;
  /** Ring thickness in px. */
  thickness?: number;
  /** Seconds for one full lap. */
  duration?: number;
  /** Freeze the animation, holding the current frame. */
  paused?: boolean;
}

/**
 * Filament — an animated conic-gradient border, a filament of light
 * orbiting the card: a white-hot head trailing a silver-to-blue tail that
 * cools and desaturates, leaving a faint slate trace before it fades.
 * Pure CSS via `@property`-animated conic gradient — zero JS, zero
 * dependencies. Honors prefers-reduced-motion by freezing the wire in place.
 */
export function Filament({
  children,
  colors = ["#ffffff", "#dbe4f0", "#93a8c4", "#5f7896"],
  radius = 16,
  thickness = 1.5,
  duration = 6,
  paused = false,
  className,
  style,
  ...rest
}: FilamentProps) {
  return (
    <div
      data-crucible="filament"
      className={cn("relative isolate overflow-hidden bg-neutral-900", className)}
      style={
        {
          "--filament-head": colors[0],
          "--filament-hot": colors[1],
          "--filament-cool": colors[2],
          "--filament-trace": colors[3],
          "--filament-thickness": `${thickness}px`,
          "--filament-duration": `${duration}s`,
          "--filament-play": paused ? "paused" : "running",
          "--filament-angle": "0deg",
          borderRadius: radius,
          ...style,
        } as React.CSSProperties
      }
      {...rest}
    >
      <style>{`
        @property --filament-angle {
          syntax: '<angle>';
          inherits: false;
          initial-value: 0deg;
        }
        @keyframes crucible-filament-spin {
          to { --filament-angle: 360deg; }
        }
        [data-crucible="filament"] .filament-ring {
          position: absolute;
          inset: 0;
          border-radius: inherit;
          padding: var(--filament-thickness);
          background: conic-gradient(
            from var(--filament-angle),
            var(--filament-head) 0%,
            var(--filament-hot) 3%,
            var(--filament-cool) 9%,
            color-mix(in oklab, var(--filament-cool) 25%, transparent) 15%,
            transparent 20%,
            color-mix(in oklab, var(--filament-trace) 35%, transparent) 30%,
            transparent 38%,
            transparent 100%
          );
          -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
          animation: crucible-filament-spin var(--filament-duration) linear infinite;
          animation-play-state: var(--filament-play);
        }
        @media (prefers-reduced-motion: reduce) {
          [data-crucible="filament"] .filament-ring {
            animation: none;
            --filament-angle: 20deg;
          }
        }
      `}</style>

      <span aria-hidden className="filament-ring pointer-events-none" />

      <div className="relative z-10">{children}</div>
    </div>
  );
}
```
