ComputeStatus
neon-ui/compute-statusFreeComponent
Compact compute readout: lifecycle state (active/idle/scaling/suspended), autoscaling CU size, and scale-to-zero, in the house status vocabulary.
Install it
npx shadcn@latest add https://ui.neon.com/r/compute-status.jsonSource
1"use client";23import type { ComponentProps } from "react";45import { Skeleton } from "@/components/ui/skeleton";6import { cn } from "@/lib/utils";78/** Compute lifecycle. `active`/`scaling` are alive and breathe; `idle`/`suspended` hold steady. */9export type ComputeState = "active" | "idle" | "scaling" | "suspended";1011interface ComputeStateConfig {12 /** Dot classes: alive states use `neon-status-breathe` + a token text color. */13 dot: string;14 label: string;15}1617/* ─────────────────────────────────────────────────────────18 * COMPUTE READOUT19 *20 * A calm mono line: a square status dot, the state word,21 * then the compute size and the scale-to-zero readout,22 * each fenced off by a hairline. Color lives only in the23 * dot, from the house status vocabulary — active green,24 * scaling amber, sleeping gray. The two alive states25 * (active, scaling) breathe on the shared 2.6s cadence and26 * hold steady under reduced motion; idle and suspended sit27 * still, and suspended dims the whole line because the28 * compute is off.29 * ───────────────────────────────────────────────────────── */30const STATE: Record<ComputeState, ComputeStateConfig> = {31 active: {32 dot: "neon-status-breathe bg-current text-[var(--status-active)]",33 label: "active",34 },35 idle: {36 dot: "bg-[var(--status-active)]",37 label: "idle",38 },39 scaling: {40 dot: "neon-status-breathe bg-current text-[var(--status-scaling)]",41 label: "scaling",42 },43 suspended: {44 dot: "bg-[var(--status-sleeping)]",45 label: "suspended",46 },47};4849// A range renders with an en dash (\u2013), e.g. 0.25–2 CU.50const formatCu = (cu: number | [number, number]) =>51 Array.isArray(cu) ? `${cu[0]}\u2013${cu[1]} CU` : `${cu} CU`;5253const Fence = () => (54 <span aria-hidden="true" className="h-3 w-px shrink-0 bg-border/60" />55);5657export type ComputeStatusProps = Omit<ComponentProps<"div">, "children"> & {58 /** Current compute lifecycle state. */59 state: ComputeState;60 /** Compute size in CU: a single value ("1.5 CU") or an autoscaling range. */61 cu?: number | [number, number];62 /**63 * Scale-to-zero readout, already phrased for context, e.g.64 * "scales to zero after 5m" or "suspended 2h ago". Omit to hide.65 */66 scaleToZero?: string;67// … truncated
What it pulls in
Other registry items
Files it writes
More from neon-ui
All 77 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ActivityFeedactivity-feed | neon-ui | Components | Free | 2 deps | |
| AgentChatagent-chat | neon-ui | Components | Free | 6 deps | |
| AnimatedWashanimated-wash | neon-ui | Components | Free | no deps · 2 files | |
| ApiKeyListapi-key-list | neon-ui | Components | Free | 2 deps | |
| AppCardapp-card | neon-ui | Components | Free | 2 deps | |
| AppCreatorapp-creator | neon-ui | Components | Free | 2 deps | |
| AuthFormauth-form | neon-ui | Components | Free | no deps | |
| AutoscaleChartautoscale-chart | neon-ui | Components | Free | 1 dep |
