Archive Transfer Loader
Transfer console with a large copper Ring Loader in a grained midnight panel, showing an archive moving from one place to another.
import type { CSSProperties } from "react"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { RingLoader } from "@/components/loader/ring-loader"
import { Grain } from "@/components/texture/grain"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Archive transfer",
channel: "Secure channel",
ringLabel: "Transferring your archive",
title: "Moving your collection.",
note: "Keep this window open while the files arrive.",
} as const
/** A large copper RingLoader portal in a grained midnight transfer console. */
export default function RingLoaderArchiveTransfer() {
return (
<Card className="dark relative isolate min-h-[26rem] justify-between rounded-none bg-[oklch(0.17_0.025_255)] text-[oklch(0.94_0.015_80)] shadow-none ring-0 [--card-spacing:--spacing(7)]">
<Grain variant="single" opacity={0.18} />
<CardHeader className="relative flex justify-between gap-4">
<Eyebrow variant="mono" render={<span className="text-current" />}>
{COPY.eyebrow}
</Eyebrow>
<Eyebrow variant="mono" render={<span className="text-current" />}>
{COPY.channel}
</Eyebrow>
</CardHeader>
<CardContent className="relative mx-auto grid size-44 place-items-center rounded-full border border-[oklch(0.45_0.025_255/0.4)]">
<RingLoader
variant="portal"
size={96}
aria-label={COPY.ringLabel}
style={
{
"--ld-a": "oklch(0.72 0.15 45)",
"--ld-b": "oklch(0.86 0.08 80)",
"--ld-c": "oklch(0.65 0.09 210)",
} as CSSProperties
}
/>
</CardContent>
<CardFooter className="relative">
<div className="w-full border-t border-[oklch(0.45_0.025_255/0.4)] pt-5">
<CardTitle className="font-display text-2xl font-normal">
{COPY.title}
</CardTitle>
<CardDescription className="mt-2 text-sm text-[oklch(0.76_0.02_255)]">
{COPY.note}
</CardDescription>
</div>
</CardFooter>
</Card>
)
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const eyebrowVariants = cva("text-eyebrow", {
variants: {
/**
* `default` is a 14px/20px label. `icon` adds a row with a 16px icon
* and a 12px gap; put the icon first and give it `aria-hidden`.
* `mono` and `caps` are 12px/20px uppercase labels with 0.12em
* tracking, in the mono and inherited faces respectively.
*/
variant: {
default: "text-sm/5 font-medium text-eyebrow",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
},
defaultVariants: { variant: "default" },
})
/**
* A short label above a heading, rendered as a `<p>` at weight 500.
* The default is 14px/20px in the kit's eyebrow color. The surrounding
* layout controls the space to the heading. Use `className` to customize
* the typography or color, and `render` to change the element.
*/
function Eyebrow({
className,
variant = "default",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import { cn } from "cn"
// Paper grain: an SVG turbulence filter as a data URI.
const PAPER_GRAIN = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250' viewBox='0 0 100 100'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='turbulence' baseFrequency='1.4' numOctaves='1' seed='2' stitchTiles='stitch' result='n'/%3E%3CfeComponentTransfer result='g'%3E%3CfeFuncR type='linear' slope='4' intercept='1'/%3E%3CfeFuncG type='linear' slope='4' intercept='1'/%3E%3CfeFuncB type='linear' slope='4' intercept='1'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix type='saturate' values='0' in='g'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`
// Sandpaper grain: an SVG turbulence filter as a data URI.
const SANDPAPER_GRAIN = `url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 100 100'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='turbulence' baseFrequency='2.2' numOctaves='2' seed='5' stitchTiles='stitch' result='n'/%3E%3CfeComponentTransfer result='g'%3E%3CfeFuncR type='linear' slope='2.5' intercept='0.8'/%3E%3CfeFuncG type='linear' slope='2.5' intercept='0.8'/%3E%3CfeFuncB type='linear' slope='2.5' intercept='0.8'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix type='saturate' values='0' in='g'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`
// Single noise: an SVG turbulence filter as a data URI.
const SINGLE_NOISE = `url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`
// Square grain: an SVG turbulence filter as a data URI.
const SQUARE_GRAIN = `url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22200%22%20height=%22200%22%20viewBox=%220%200%20100%20100%22%3E%3Cfilter%20id=%22n%22%20color-interpolation-filters=%22sRGB%22%3E%3CfeTurbulence%20type=%22turbulence%22%20baseFrequency=%222.1%22%20numOctaves=%223%22%20seed=%2211%22%20stitchTiles=%22stitch%22%20result=%22n%22/%3E%3CfeComponentTransfer%20result=%22g%22%3E%3CfeFuncR%20type=%22linear%22%20slope=%225.5%22%20intercept=%221.4%22/%3E%3CfeFuncG%20type=%22linear%22%20slope=%225.5%22%20intercept=%221.4%22/%3E%3CfeFuncB%20type=%22linear%22%20slope=%225.5%22%20intercept=%221.4%22/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix%20type=%22saturate%22%20values=%220%22%20in=%22g%22/%3E%3C/filter%3E%3Crect%20width=%22100%%22%20height=%22100%%22%20filter=%22url(%23n)%22/%3E%3C/svg%3E")`
type Intensity = "fine" | "default" | "rich"
// One scale for every texture; `default` is the unscaled value.
const INTENSITY_MULT: Record<Intensity, number> = {
fine: 0.6,
default: 1,
rich: 1.45,
}
const alpha = (base: number, mult: number) => (base * mult).toFixed(4)
// Four grain treatments; each paints a single texture layer.
// Full-bleed art layer — drop inside a `relative` parent; sits behind content.
/** The texture treatment painted by `Grain`. */
type GrainVariant =
// Stylized paper-look variants — heavier filter chain than plain noise.
"paper" | "sandpaper" | "square" | "single"
type Layer = {
src: string
size: string
opacity: number
blend: "overlay" | "soft-light"
}
const BLEND_CLASS: Record<Layer["blend"], string> = {
overlay: "mix-blend-overlay",
"soft-light": "mix-blend-soft-light",
}
const VARIANT_TEXTURES: Record<GrainVariant, Layer> = {
paper: {
src: PAPER_GRAIN,
size: "250px",
opacity: 0.25,
blend: "overlay",
},
sandpaper: {
src: SANDPAPER_GRAIN,
size: "200px",
opacity: 0.25,
blend: "overlay",
},
square: {
src: SQUARE_GRAIN,
size: "200px",
opacity: 0.8,
blend: "soft-light",
},
single: { src: SINGLE_NOISE, size: "200px", opacity: 0.3, blend: "overlay" },
}
/**
* A decorative grain layer that fills a positioned parent without blocking
* clicks. Choose a texture and adjust its strength with `intensity` or
* `opacity`. `className` and other div props land on the outer layer.
*/
function Grain({
variant = "single",
intensity = "default",
opacity,
isolated = false,
className,
...props
}: React.ComponentProps<"div"> & {
/** The grain treatment: `single` (default), `paper`, `sandpaper` or `square`. */
variant?: GrainVariant
/** Multiplies the texture's opacity: `fine` 0.6×, `default` 1×, `rich` 1.45×. */
intensity?: Intensity
/** The texture opacity, from 0 to 1. Takes precedence over `intensity`. */
opacity?: number
/**
* Adds paint containment when true. This creates a stacking context, so
* the texture stops blending with scene layers outside this element.
*/
isolated?: boolean
}) {
const layer = VARIANT_TEXTURES[variant]
const m =
opacity != null ? opacity / layer.opacity : INTENSITY_MULT[intensity]
return (
<div
data-slot="grain"
data-variant={variant}
aria-hidden="true"
className={cn(
"pointer-events-none absolute inset-0",
isolated && "contain-[paint]",
className
)}
{...props}
>
<div
className={cn("absolute inset-0", BLEND_CLASS[layer.blend])}
style={{
backgroundImage: layer.src,
backgroundSize: layer.size,
opacity: layer.opacity * m,
}}
/>
</div>
)
}
export { Grain }
import { cn } from "cn"
// Ring Loader — five calm ring loaders from the void set. All motion is
// transform/opacity only; reduced motion swaps spins for a slow breath.
// The default trio, Voice Orb's planet-14 colors: its scarlet pair, and its
// cobalt lifted to a mid blue so all three read on light and dark pages.
// Override the vars to retint.
const PALETTE = {
"--ld-a": "oklch(0.62 0.19 38)",
"--ld-b": "oklch(0.55 0.19 32)",
"--ld-c": "oklch(0.56 0.15 262)",
}
const RING_MASK =
"radial-gradient(farthest-side, transparent calc(100% - 4px), black calc(100% - 3px))"
const CSS = `@keyframes ld-spin{to{transform:rotate(360deg)}}
@keyframes ld-pulse{0%,100%{opacity:0.6;transform:scale(1)}50%{opacity:1;transform:scale(0.92)}}
@keyframes ld-breathe{0%,100%{opacity:0.45}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){[data-slot="ring-loader"] *{animation:ld-breathe 2.5s ease-in-out infinite !important}}`
type LoaderVariant = "portal" | "arc" | "orbit" | "pulse" | "crescent"
/**
* A small ring spinner in one of five styles, for a loading state. Colors
* come from the `--ld-a`, `--ld-b` and `--ld-c` variables, which you can
* override through `style`; the faint tracks use `currentColor`.
*
* Exposes `role="status"` with the label "Loading"; pass `aria-label` to
* change it. With reduced motion every spin and pulse becomes a slow opacity
* breath.
*/
function RingLoader({
variant = "portal",
size = 48,
className,
style,
...props
}: React.ComponentProps<"div"> & {
/**
* `portal` spins a three-color ring, `arc` a fading arc, `orbit` a dot
* around a faint track, `pulse` pulses a ring and a center dot, and
* `crescent` spins an arc over a faint track.
*/
variant?: LoaderVariant
/** Width and height in px. */
size?: number
}) {
const ring = (background: string, animation: string) => (
<i
className="absolute inset-0 rounded-full"
style={{
background,
mask: RING_MASK,
animation,
}}
/>
)
return (
<div
data-variant={variant}
role="status"
aria-label="Loading"
className={cn("relative inline-block", className)}
style={
{
width: size,
height: size,
...PALETTE,
...style,
} as React.CSSProperties
}
// After the spread: the reduced-motion CSS above selects on this slot.
data-slot="ring-loader"
{...props}
>
<style>{CSS}</style>
{variant === "portal" &&
ring(
"conic-gradient(from 180deg, var(--ld-a), var(--ld-b), var(--ld-c), var(--ld-a))",
"ld-spin 2s linear infinite"
)}
{variant === "arc" &&
ring(
"conic-gradient(from 0deg, var(--ld-b), transparent 120deg)",
"ld-spin 1.8s linear infinite"
)}
{variant === "orbit" && (
<>
<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>
</>
)}
{variant === "pulse" && (
<>
{ring(
"conic-gradient(from 180deg, var(--ld-a), var(--ld-c), var(--ld-a))",
"ld-pulse 2s ease-in-out infinite"
)}
<i className="absolute top-1/2 left-1/2 size-[30%] -translate-1/2 animate-[ld-pulse_2s_ease-in-out_0.2s_infinite] rounded-full bg-(--ld-b)" />
</>
)}
{variant === "crescent" && (
<>
<i className="absolute inset-0 rounded-full border-2 border-current/8" />
{ring(
"conic-gradient(from 270deg, var(--ld-b), var(--ld-a), transparent 90deg, transparent)",
"ld-spin 2s linear infinite"
)}
</>
)}
</div>
)
}
export { RingLoader }
Installation
pnpm dlx shadcn@latest add @01orbital/archive-transfer-01npx shadcn@latest add @01orbital/archive-transfer-01yarn dlx shadcn@latest add @01orbital/archive-transfer-01bunx --bun shadcn@latest add @01orbital/archive-transfer-01Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/loader/archive-transfer-01/index.tsx: change them there, not in the markup. - Its look comes from Grain; each page lists the props that change it.
Built from
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.
Last updated on