Skip to content

StatusPill

Payment and reconciliation states.
Implemented
Status
Implemented
Family
1 of 13
Registry
@lopifi/status-pill
npx shadcn@latest add @lopifi/theme @lopifi/status-pill

The component, rendering

Real data, the shipped component. Switch the theme to check the claims the spec makes below.

Preview

The four-layer spec

<StatusPill status="pending" />       // ◷ Pending    amber, subtle bg
<StatusPill status="settled" />       // ✓ Settled    positive
<StatusPill status="failed" />        // ✕ Failed     negative
<StatusPill status="reconciled" />
<StatusPill status="needs-review" />

*-subtle background, * text, never a saturated fill. Icon + text always — the icon alone is not a status. Accessible name includes the entity: "Payment pending".

State change: 140ms crossfade with a 2px blur mask, so the pill morphs rather than swapping. One of the small places the blur trick earns its keep.

Lifted verbatim from Primitives. 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/status-pill.tsx

Lopifi dependencies · 3
cniconsmoney.types
npm packages
clsxtailwind-merge
Registry entry
/r/status-pill.json

The whole component

No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.

components/ledger/status-pill.tsx
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import type { PaymentStatus } from "@/lib/ledger/money.types";
import {
  ArrowPathIcon,
  ArrowUturnLeftIcon,
  CheckIcon,
  ClockIcon,
  EllipsisHorizontalCircleIcon,
  ExclamationTriangleIcon,
  LinkIcon,
  NoSymbolIcon,
  PaperAirplaneIcon,
  TruckIcon,
  XMarkIcon,
} from "@/components/ledger/icons";

type Tone = "positive" | "negative" | "warning" | "neutral" | "accent";

const CONFIG: Record<
  PaymentStatus,
  { label: string; tone: Tone; icon: React.ComponentType<{ className?: string }> }
> = {
  cancelled: { icon: NoSymbolIcon, label: "Cancelled", tone: "neutral" },
  draft: { icon: EllipsisHorizontalCircleIcon, label: "Draft", tone: "neutral" },
  failed: { icon: XMarkIcon, label: "Failed", tone: "negative" },
  "in-transit": { icon: TruckIcon, label: "In transit", tone: "accent" },
  matched: { icon: CheckIcon, label: "Matched", tone: "positive" },
  "needs-review": { icon: ExclamationTriangleIcon, label: "Needs review", tone: "warning" },
  overdue: { icon: ExclamationTriangleIcon, label: "Overdue", tone: "negative" },
  // Pending is a state, not a load — a clock, never a spinner.
  pending: { icon: ClockIcon, label: "Pending", tone: "warning" },
  processing: { icon: ArrowPathIcon, label: "Processing", tone: "warning" },
  reconciled: { icon: LinkIcon, label: "Reconciled", tone: "positive" },
  returned: { icon: ArrowUturnLeftIcon, label: "Returned", tone: "negative" },
  scheduled: { icon: ClockIcon, label: "Scheduled", tone: "neutral" },
  sent: { icon: PaperAirplaneIcon, label: "Sent", tone: "accent" },
  settled: { icon: CheckIcon, label: "Settled", tone: "positive" },
};

const TONES: Record<Tone, string> = {
  accent: "bg-accent-subtle text-accent",
  negative: "bg-negative-subtle text-negative",
  neutral: "bg-surface-sunken text-text-secondary",
  // Tint, not fill. Saturated fills are reserved for the one primary action.
  positive: "bg-positive-subtle text-positive",
  warning: "bg-warning-subtle text-warning",
};

export interface StatusPillProps extends React.ComponentPropsWithoutRef<"span"> {
  /** The entity, so the accessible name reads "Payment pending". */
  entity?: string;
  size?: "sm" | "md";
  status: PaymentStatus;
}

/** Icon and text, always. An icon alone is not a status. */
export const StatusPill = React.forwardRef<HTMLSpanElement, StatusPillProps>(
  ({ className, status, entity, size = "sm", ...props }, ref) => {
    const config = CONFIG[status];
    const Icon = config.icon;
    return (
      <span
        className={cn(
          "relative inline-flex select-none items-center gap-1 rounded-sm font-medium",
          "transition-colors duration-2 ease-standard",
          size === "sm" ? "h-6 px-2 text-caption" : "h-8 px-3 text-label",
          TONES[config.tone],
          className,
        )}
        ref={ref}
        {...props}
      >
        <Icon aria-hidden="true" className={size === "sm" ? "size-3" : "size-3.5"} />
        <span aria-hidden="true">{config.label}</span>
        {/* Spoken text, not an aria-label: a label on a role-less span is
            prohibited ARIA. select-none keeps it out of a copied selection. */}
        <span className="sr-only select-none">
          {entity ? `${entity} ${config.label.toLowerCase()}` : config.label}
        </span>
      </span>
    );
  },
);
StatusPill.displayName = "StatusPill";

export const STATUS_LABELS = CONFIG;

The accounting it encodes

Concepts this component renders. Each one is defined once, in the lexicon, and used identically in the code and the copy.

Also in Primitives

See also

A component is specified in one place, defined in another, and running in a third. All three, from here.

Elsewhere in the system

Where StatusPill 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.

Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.

Told when Primitives 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.

One address, no list rental, unsubscribe in one click.

Works in your QuickBooks Online or Xero file

Get your books closed every month

Lopifi is building AI bookkeeping that keeps your books closed on US GAAP as transactions happen, with a CPA review every quarter, for $200 a month. We’re not open yet.

$200/month when we open. No card now.