Skip to content

Invoice Table

Receivables table with status pills, days-late aging text, mono amounts, a totals footer and a per-row Radix dropdown (view, send reminder, duplicate, void).

neo-corporate/ui/invoice-table
Open ↗

Source

"use client";

import { DropdownMenu } from "radix-ui";
import { MoreHorizontal } from "lucide-react";
import { cn } from "@/lib/utils";

export interface InvoiceTableRow {
  number: string;
  customer: string;
  amount: number;
  due: string;
  status: "paid" | "open" | "overdue" | "draft";
  /** Days past due (overdue only). */
  daysLate?: number;
}

export interface InvoiceTableProps {
  rows?: InvoiceTableRow[];
  onAction?: (action: "view" | "remind" | "duplicate" | "void", invoice: string) => void;
  da?: string;
  className?: string;
}

const DEFAULT_ROWS: InvoiceTableRow[] = [
  { number: "INV-2041", customer: "Northwind Traders", amount: 18400, due: "Oct 14", status: "open" },
  { number: "INV-2040", customer: "Lumen Health", amount: 6250, due: "Oct 02", status: "paid" },
  { number: "INV-2039", customer: "Parcel Logistics", amount: 42900, due: "Sep 18", status: "overdue", daysLate: 6 },
  { number: "INV-2038", customer: "Quanta Labs", amount: 27450, due: "Aug 29", status: "overdue", daysLate: 26 },
  { number: "INV-2037", customer: "Heliograph", amount: 950, due: "—", status: "draft" },
];

const STATUS = {
  paid: ["Paid", "bg-da-success/12 text-da-success"],
  open: ["Open", "bg-da-primary/10 text-da-primary"],
  overdue: ["Overdue", "bg-da-danger/10 text-da-danger"],
  draft: ["Draft", "bg-da-muted text-da-muted-fg"],
} as const;

/** Receivables table with status pills, days-late aging text, mono amounts, a totals footer and a per-row Radix dropdown (view, send reminder, duplicate, void). */
export function InvoiceTable({ rows = DEFAULT_ROWS, onAction, da = "neo-corporate", className }: InvoiceTableProps) {
  const fmt = (n: number) => n.toLocaleString("en-US", { style: "currency", currency: "USD" });
  const open = rows.filter((r) => r.status === "open" || r.status === "overdue").reduce((s, r) => s + r.amount, 0);
  const item = "flex cursor-default items-center rounded-da-sm px-2 py-1.5 text-sm outline-none data-highlighted:bg-da-muted";
  return (
    <div
      className={cn("da-stroke relative overflow-x-auto rounded-da-lg bg-da-surface text-da-surface-fg shadow-da-sm", className)}
      role="region"
      aria-label="Invoices"
      tabIndex={0}
    >
      <table className="w-full min-w-[640px] text-sm">
        <caption className="sr-only">Invoices</caption>
        <thead className="border-b border-da-border bg-da-surface-2 text-left text-xs text-da-muted-fg">
          <tr>
            <th scope="col" className="px-4 py-2.5 font-medium">
              Invoice
            </th>
            <th scope="col" className="px-4 py-2.5 font-medium">
              Customer
            </th>
            <th scope="col" className="px-4 py-2.5 font-medium">
              Status
            </th>
            <th scope="col" className="px-4 py-2.5 font-medium">
              Due
            </th>
            <th scope="col" className="px-4 py-2.5 text-right font-medium">
              Amount
            </th>
            <th scope="col" className="w-12 px-4 py-2.5">
              <span className="sr-only">Actions</span>
            </th>
          </tr>
        </thead>
        <tbody className="divide-y divide-da-border">
          {rows.map((r) => (
            <tr key={r.number} className="da-transition hover:bg-da-surface-2">
              <td className="px-4 py-3 font-da-mono text-xs">{r.number}</td>
              <td className="px-4 py-3 font-medium">{r.customer}</td>
              <td className="px-4 py-3">
                <span className={cn("rounded-da-pill px-2 py-0.5 text-xs font-semibold", STATUS[r.status][1])}>{STATUS[r.status][0]}</span>
              </td>
              <td className="px-4 py-3">
                {r.due}
                {r.daysLate ? <span className="ml-2 text-xs font-medium text-da-danger">{r.daysLate}d late</span> : null}
              </td>
              <td className="px-4 py-3 text-right font-da-mono tabular-nums">{fmt(r.amount)}</td>
              <td className="px-2 py-2 text-right">
                <DropdownMenu.Root modal={false}>
                  <DropdownMenu.Trigger
                    aria-label={`Actions for ${r.number}`}
                    className="da-focus grid size-8 place-items-center rounded-da-md text-da-muted-fg hover:bg-da-muted hover:text-da-fg"
                  >
                    <MoreHorizontal aria-hidden className="size-4" />
                  </DropdownMenu.Trigger>
                  <DropdownMenu.Portal>
                    <DropdownMenu.Content
                      data-da={da}
                      align="end"
                      sideOffset={4}
                      className="da-stroke z-50 min-w-44 rounded-da-md bg-da-surface p-1 text-da-surface-fg shadow-da-lg transition-opacity duration-(--da-duration) starting:opacity-0"
                    >
                      <DropdownMenu.Item className={item} onSelect={() => onAction?.("view", r.number)}>
                        View invoice
                      </DropdownMenu.Item>
                      <DropdownMenu.Item
                        className={item}
                        disabled={r.status === "paid" || r.status === "draft"}
                        onSelect={() => onAction?.("remind", r.number)}
                      >
                        <span className="data-disabled:opacity-50">Send reminder</span>
                      </DropdownMenu.Item>
                      <DropdownMenu.Item className={item} onSelect={() => onAction?.("duplicate", r.number)}>
                        Duplicate
                      </DropdownMenu.Item>
                      <DropdownMenu.Separator className="my-1 h-px bg-da-border" />
                      <DropdownMenu.Item className={cn(item, "text-da-danger data-highlighted:bg-da-danger/10")} onSelect={() => onAction?.("void", r.number)}>
                        Void
                      </DropdownMenu.Item>
                    </DropdownMenu.Content>
                  </DropdownMenu.Portal>
                </DropdownMenu.Root>
              </td>
            </tr>
          ))}
        </tbody>
        <tfoot className="border-t border-da-border bg-da-surface-2">
          <tr>
            <th scope="row" colSpan={4} className="px-4 py-3 text-left font-semibold">
              Total outstanding
            </th>
            <td className="px-4 py-3 text-right font-da-mono font-medium tabular-nums">{fmt(open)}</td>
            <td />
          </tr>
        </tfoot>
      </table>
    </div>
  );
}

export default InvoiceTable;

modules/neo-corporate/ui/invoice-table/index.tsx

Props

PropTypeDefaultDescription
rowsInvoiceTableRow[]—Rows.
onAction(action: "view" | "remind" | "duplicate" | "void", invoice: string) => void—Callback.
dastring—DA scope applied to portalled content.
classNamestring—Extra classes on the root.

Other table variants in Neo Corporate

Table in other art directions

Data Table

Typed generic table with a yellow caption bar + toolbar slot, ruled rows, sortable columns (asc → desc → none), custom cell renderers, mobile column hiding, empty state and optional row click.

BrutalistTable

Expandable Table

Table with expandable rows: a ruled chevron square per row reveals a detail row underneath; the open row floods yellow. Single or multiple open rows.

BrutalistTable

Leaderboard Table

Ranked list with ink header, colored podium squares for the top 3, proportional background bars behind each row, rank-change chips (▲/▼) and big tabular values. Sorts by value automatically.

BrutalistTable

Simple Table

Server-safe static table: uppercase caption, ink header row with column rules, zebra rows, right-aligned mono numeric columns and an optional yellow totals footer.

BrutalistTable

Action Items Table

Action items table with Open / Done / All filter pills and counts, gradient checkboxes that strike tasks through, owner, due chip (overdue in red) and source meeting; empty state.

GlassTable

Data Table

Frosted table panel with title, description, pill search field and actions slot; rows are separated translucent rounded strips that brighten on hover. Typed generic columns, sorting, mobile hiding, empty state.

GlassTable

Meetings Table

Recent meetings glass table: title with gradient video icon and platform, date, mono duration, participant avatar stack and a recap status pill (ready, processing, private).

GlassTable

Usage Table

Team usage glass table: member, inline gradient bar of recorded hours relative to the top member, meetings count and hours saved, with a tinted totals row.

GlassTable

Data Table

Typed generic table with hairline rows, sortable headers, optional row selection (select-all with indeterminate state) and a floating bulk-action bar. Custom cells, mobile column hiding, empty state.

MinimalTable

Grouped Table

Services table grouped by team: collapsible tinted group rows with service count and alert subtotal, then rows with status dot, mono service name, owner, alerts and MTTA.

MinimalTable

Paginated Table

Audit-log table with client-side pagination: page-size select, “1–10 of 47” range, numbered pages with ellipsis and prev/next; mono timestamps and IPs, horizontal scroll on mobile.

MinimalTable

Uptime Table

Status-page uptime table: one row per service with 30 daily bars colored by threshold (≥ 99.99 %, ≥ 99 %, below), a current-status dot, the 30-day average and a legend.

MinimalTable

Changelog Table

Release log laid out as a table: mono version + ISO date column, a square type tag (New in signal color, Improved outlined, Fixed gray) and dash-listed notes; hairline rows.

Mono CleanTable

Data Table

Analytics table in pure typography: mono headers that sort (↑/↓ glyph, aria-sort), hairline rows, tabular numbers, inline hairline bars for share of views, and an ink total row.

Mono CleanTable

Projects Table

Studio project index (the classic portfolio list): large titles with client, discipline and year in mono columns; each row is one link that inverts to ink on hover with an ↗.

Mono CleanTable

Sites Table

Sites dashboard table: name + domain link, dot status in mono, template, updated time and a “…” Radix dropdown (open, duplicate, archive); hairline rows.

Mono CleanTable

Actions Table

Reduction plan table: round checkboxes mark actions done (row softens), owner and due date, mono savings, and a progress header showing tonnes secured toward the target.

Organic SoftTable

Emissions Table

Emissions by category: rounded cream table with scope leaf chips, inline sage share bars behind the tonnes, mono figures, colored year-over-year change and a total row.

Organic SoftTable

Monthly Table

Month × scope heat table: each cell tinted by intensity along a sand→sage→forest scale with mono values; row totals and a legend; readable without color.

Organic SoftTable

Supplier Table

Supplier engagement table: filter pills by status, arch avatars, share of footprint, status pill and 3-dot data quality meter, with a per-row “Nudge” pill that turns into “Sent”.

Organic SoftTable

Activity Table

Activity log table: kind icon in a pastel circle, emoji avatar and sentence (“Ana completed …”), board chip and relative time; rows highlight softly on hover.

Soft FlatTable

Simple Table

Plain friendly data table in a rounded white card: soft header well, roomy rows, gentle zebra and right-aligned numbers; generic columns and rows props.

Soft FlatTable

Task Table

“My tasks” table where each row is a soft rounded strip: round done checkbox, title (struck when done), pastel board chip, owner initial avatar and due chip (red when overdue).

Soft FlatTable

Workload Table

Team workload heat table: a row per person (emoji + name), one rounded cell per weekday tinted mint → butter → peach by number of tasks, with a legend.

Soft FlatTable