StaleIndicator
- Status
- Implemented
- Family
- 8 of 13
- Registry
- @lopifi/stale-indicator
npx shadcn@latest add @lopifi/theme @lopifi/stale-indicatorThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
"Last synced 12m ago · Retry". Appears on any surface showing cached or offline data. Dims the affected values to 0.7.
Stale financial data presented as current is the most dangerous state in the product. This component exists so that state is impossible to miss.
Lifted verbatim from System & states. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/stale-indicator.tsx
- npm packages
- @base-ui-components/reactclsxtailwind-merge
- Registry entry
- /r/stale-indicator.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import { AsOf } from "@/components/ledger/as-of";
import { ArrowPathIcon } from "@/components/ledger/icons";
export interface StaleIndicatorProps extends React.ComponentPropsWithoutRef<"div"> {
lastSynced: Date;
onRetry?: () => void;
timeZone?: string;
}
/**
* Stale financial data presented as current is the most dangerous state in
* the product. This component exists so that state is impossible to miss.
*/
export const StaleIndicator = React.forwardRef<HTMLDivElement, StaleIndicatorProps>(
({ className, lastSynced, onRetry, timeZone, ...props }, ref) => (
<div
className={cn("inline-flex items-center gap-2 rounded-sm bg-warning-subtle px-2 py-1", className)}
ref={ref}
role="status"
{...props}
>
<span aria-hidden="true" className="size-1.5 rounded-full bg-[var(--warning)]" />
{/* The date carries the alarm; the clock time and zone are on hover. The
full stamp is the longest run of text in a strip that has to fit
inside a card, and it is the part nobody reads first. */}
<AsOf
className="text-caption text-text-secondary"
compact
date={lastSynced}
prefix="Last synced"
timeZone={timeZone}
/>
{onRetry ? (
<button
className="inline-flex items-center gap-1 text-caption font-medium text-accent hover:underline"
onClick={onRetry}
type="button"
>
<ArrowPathIcon aria-hidden="true" className="size-3" />
Retry
</button>
) : null}
</div>
),
);
StaleIndicator.displayName = "StaleIndicator";
Also in System & states
- EmptyStateThree variants. Always one next action.
- ErrorStateWith the financial reassurance sentence.
- SkeletonStructural, per-component.
- ToastSonner, configured to our tokens.
- CommandPaletteMotionless. Money-aware search.
- SheetVaul, configured. The mobile primary overlay.
- HoldToConfirmIrreversible actions, with accessible fallbacks.
- DensityTogglePersisted, synced, phone-clamped.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- System & states — the family specThe four-layer specification this component was built against, before it was written.Doc
- States, density and system componentsThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
Elsewhere in the system
Where StaleIndicator sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- StaleIndicator, runningThe system showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Reading, paging and delta syncHow do you get everything out, and then keep it fresh?API
- Webhooks and freshnessHow do you find out something changed?API
- System & statesThe states that decide whether a product feels finished. Specs for 9 React components: EmptyState, ErrorState, Skeleton, StaleIndicator and 5 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when System & states changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.