Skip to content

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-soft/ui/supplier-table
Open ↗

Source

"use client";

import { useState } from "react";
import { cn } from "@/lib/utils";

export interface SupplierRow {
  name: string;
  category: string;
  share: number;
  status: "shared" | "invited" | "estimated";
  quality: 1 | 2 | 3;
}

export interface SupplierTableProps {
  rows?: SupplierRow[];
  className?: string;
}

const DEFAULT_ROWS: SupplierRow[] = [
  { name: "Moulin Paper Co.", category: "Packaging", share: 18, status: "shared", quality: 3 },
  { name: "Rhône Freight", category: "Road freight", share: 14, status: "invited", quality: 1 },
  { name: "Kiln & Clay", category: "Ceramics", share: 11, status: "shared", quality: 2 },
  { name: "Alpine Cloud", category: "Hosting", share: 7, status: "estimated", quality: 1 },
  { name: "Lumen Textiles", category: "Fabrics", share: 6, status: "invited", quality: 1 },
];

const STATUS = {
  shared: ["Data shared", "bg-da-accent text-da-accent-fg"],
  invited: ["Invited", "bg-da-secondary text-da-secondary-fg"],
  estimated: ["Estimated", "bg-da-surface-2 text-da-muted-fg"],
} as const;

/** 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”. */
export function SupplierTable({ rows = DEFAULT_ROWS, className }: SupplierTableProps) {
  const [filter, setFilter] = useState<"all" | SupplierRow["status"]>("all");
  const [nudged, setNudged] = useState<string[]>([]);
  const list = rows.filter((r) => filter === "all" || r.status === filter);
  return (
    <div className={cn("rounded-da-lg bg-da-surface text-da-surface-fg shadow-da-sm", className)}>
      <div role="group" aria-label="Filter by status" className="flex flex-wrap gap-2 p-5">
        {(["all", "shared", "invited", "estimated"] as const).map((f) => (
          <button
            key={f}
            type="button"
            aria-pressed={filter === f}
            onClick={() => setFilter(f)}
            className={cn(
              "da-focus da-transition rounded-da-pill px-4 py-1.5 text-sm capitalize",
              filter === f ? "bg-da-primary text-da-primary-fg" : "bg-da-surface-2 hover:bg-da-muted",
            )}
          >
            {f}
          </button>
        ))}
      </div>
      <div className="relative overflow-x-auto" role="region" aria-label="Suppliers" tabIndex={0}>
        <table className="w-full min-w-[620px]">
          <caption className="sr-only">Suppliers ({list.length})</caption>
          <thead className="text-left text-sm text-da-muted-fg">
            <tr>
              <th scope="col" className="px-5 py-2 font-normal">
                Supplier
              </th>
              <th scope="col" className="px-3 py-2 text-right font-normal">
                Share
              </th>
              <th scope="col" className="px-3 py-2 font-normal">
                Status
              </th>
              <th scope="col" className="px-3 py-2 font-normal">
                Data quality
              </th>
              <th scope="col" className="px-5 py-2">
                <span className="sr-only">Action</span>
              </th>
            </tr>
          </thead>
          <tbody>
            {list.map((r) => (
              <tr key={r.name} className="border-t border-da-border">
                <td className="px-5 py-3">
                  <div className="flex items-center gap-3">
                    <span
                      aria-hidden
                      className="grid h-10 w-9 place-items-center rounded-t-full rounded-b-da-sm bg-da-accent font-da-display text-da-accent-fg"
                    >
                      {r.name[0]}
                    </span>
                    <span>
                      <span className="block font-medium">{r.name}</span>
                      <span className="block text-sm text-da-muted-fg">{r.category}</span>
                    </span>
                  </div>
                </td>
                <td className="px-3 py-3 text-right font-da-mono text-sm">{r.share}%</td>
                <td className="px-3 py-3">
                  <span className={cn("rounded-da-pill px-2.5 py-0.5 text-xs font-medium", STATUS[r.status][1])}>{STATUS[r.status][0]}</span>
                </td>
                <td className="px-3 py-3">
                  <span role="img" aria-label={`Quality ${r.quality} of 3`} className="flex gap-1">
                    {[1, 2, 3].map((i) => (
                      <span key={i} className={cn("size-2.5 rounded-full", i <= r.quality ? "bg-da-primary" : "bg-da-surface-2")} />
                    ))}
                  </span>
                </td>
                <td className="px-5 py-3 text-right">
                  {r.status !== "shared" && (
                    <button
                      type="button"
                      disabled={nudged.includes(r.name)}
                      onClick={() => setNudged([...nudged, r.name])}
                      className="da-focus da-transition rounded-da-pill bg-da-surface-2 px-3.5 py-1.5 text-sm hover:bg-da-muted disabled:bg-transparent disabled:text-da-primary"
                    >
                      {nudged.includes(r.name) ? "Sent ✓" : "Nudge"}
                      <span className="sr-only"> {r.name}</span>
                    </button>
                  )}
                </td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>
    </div>
  );
}

export default SupplierTable;

modules/organic-soft/ui/supplier-table/index.tsx

Props

PropTypeDefaultDescription
rowsSupplierRow[]—Rows.
classNamestring—Extra classes on the root.

Other table variants in Organic Soft

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

Approvals Table

Bill approval queue: vendor + requester, category, mono amount and inline Approve / Reject buttons that turn the row into a decided state (with Undo); pending count in the header.

Neo CorporateTable

Data Table

Customer data table: sortable headers (aria-sort), row checkboxes with select-all (indeterminate), bulk-action bar when rows are selected, mono amounts and pagination.

Neo CorporateTable

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 CorporateTable

Ledger Table

General-ledger table grouped by date: journal ref and memo, GL account, debit/credit columns in mono, credits indented, and balanced totals row with a “Balanced” check.

Neo CorporateTable

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