Blocks / Issue board

Issue board

Issues as cards in columns. Layout only: moving a card is the caller's.

import { IssueBoard } from "@forgeron/ui";
/01 → Default
import { IssueBoard } from "@forgeron/ui";

export default function Default() {
  return (
    <IssueBoard
      people={[
        { id: "hb", name: "Hugo Bernard" },
        { id: "np", name: "Nadia Petit" },
      ]}
      labels={[
        { value: "bug", label: "Bug", color: "var(--danger)" },
        { value: "warehouse", label: "Warehouse", color: "var(--warning)" },
      ]}
      today="2026-11-17"
      columns={[
        {
          key: "review",
          name: "In Review",
          status: "review",
          issues: [
            {
              id: "OPS-40",
              title: "Supplier invoices arrive twice from Odoo",
              status: "review",
              priority: 1,
              labels: ["bug"],
              assignee: "hb",
            },
            {
              id: "OPS-34",
              title: "Fire exit signage audit",
              status: "review",
              priority: 3,
              labels: ["warehouse"],
              due: "2026-11-18",
              assignee: "np",
            },
          ],
        },
      ]}
    />
  );
}
/02 → By status
Click a card, a + or a ⋯
import { IssueBoard } from "@forgeron/ui";
import { useState } from "react";

const labels = [
  { value: "bug", label: "Bug", color: "var(--danger)" },
  { value: "feature", label: "Feature", color: "var(--accent)" },
  { value: "improvement", label: "Improvement", color: "var(--ink-muted)" },
  { value: "customer", label: "Customer", color: "var(--success)" },
  { value: "warehouse", label: "Warehouse", color: "var(--warning)" },
];
const people = [
  { id: "cr", name: "Camille Roy" },
  { id: "hb", name: "Hugo Bernard" },
  { id: "lm", name: "Léa Martin" },
  { id: "np", name: "Nadia Petit" },
  { id: "tg", name: "Tom Garnier" },
];

export default function ByStatus() {
  const [last, setLast] = useState("Click a card, a + or a ⋯");
  return (
    <div style={{ width: "100%", display: "grid", gap: 12 }}>
      <IssueBoard
        labels={labels}
        people={people}
        today="2026-11-17"
        defaultCollapsed={["done"]}
        onOpen={(id) => setLast(`Open ${id}`)}
        onAdd={(column) => setLast(`New issue in ${column}`)}
        onColumnMenu={(column) => setLast(`Options of ${column}`)}
        columns={[
          {
            key: "todo",
            name: "Todo",
            status: "todo",
            issues: [
              {
                id: "OPS-29",
                title: "Quarterly safety walk, Lyon",
                status: "todo",
                priority: 3,
                labels: ["warehouse"],
                due: "2026-12-05",
                assignee: "tg",
              },
              {
                id: "OPS-42",
                title: "Pallet labels print off-centre",
                status: "todo",
                priority: 4,
                labels: ["improvement"],
              },
            ],
          },
          {
            key: "progress",
            name: "In Progress",
            status: "progress",
            issues: [
              {
                id: "OPS-40",
                title: "Supplier invoices arrive twice from Odoo",
                status: "progress",
                priority: 1,
                labels: ["bug", "customer"],
                due: "2026-11-12",
                assignee: "hb",
              },
              {
                id: "OPS-37",
                title: "Carrier rates: import the new grid",
                status: "progress",
                priority: 2,
                labels: ["feature"],
                assignee: "cr",
              },
            ],
          },
          {
            key: "review",
            name: "In Review",
            status: "review",
            issues: [
              {
                id: "OPS-34",
                title: "Fire exit signage audit",
                status: "review",
                priority: 3,
                labels: ["warehouse"],
                due: "2026-11-18",
                assignee: "np",
              },
            ],
          },
          {
            key: "done",
            name: "Done",
            status: "done",
            issues: [
              {
                id: "OPS-33",
                title: "Badge readers at the Lyon dock",
                status: "done",
                assignee: "lm",
              },
            ],
          },
        ]}
      />
      <span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>{last}</span>
    </div>
  );
}
/03 → Editable
  • OPS-37
    Assignee
    Status
    Carrier rates: import the new grid
    Priority
    Labels
  • OPS-29
    Assignee
    Status
    Quarterly safety walk, Lyon
    Priority
    Labels
  • OPS-40
    Assignee
    Status
    Supplier invoices arrive twice from Odoo
    Priority
    Labels
    import { IssueBoard, type IssueGroup, type IssueItem } from "@forgeron/ui";
    import { useState } from "react";
    
    const labels = [
      { value: "bug", label: "Bug", color: "var(--danger)" },
      { value: "feature", label: "Feature", color: "var(--accent)" },
      { value: "warehouse", label: "Warehouse", color: "var(--warning)" },
    ];
    const people = [
      { id: "cr", name: "Camille Roy" },
      { id: "hb", name: "Hugo Bernard" },
      { id: "lm", name: "Léa Martin" },
    ];
    const start: IssueItem[] = [
      {
        id: "OPS-40",
        title: "Supplier invoices arrive twice from Odoo",
        status: "progress",
        priority: 1,
        labels: ["bug"],
        due: "2026-11-12",
        assignee: "hb",
      },
      {
        id: "OPS-37",
        title: "Carrier rates: import the new grid",
        status: "todo",
        priority: 2,
        labels: ["feature"],
        assignee: "cr",
      },
      { id: "OPS-29", title: "Quarterly safety walk, Lyon", status: "todo", assignee: null },
    ];
    const ORDER = ["todo", "progress", "done"] as const;
    const NAMES = { todo: "Todo", progress: "In Progress", done: "Done" };
    
    export default function Editable() {
      const [issues, setIssues] = useState(start);
      const columns: IssueGroup[] = ORDER.map((s) => ({
        key: s,
        name: NAMES[s],
        status: s,
        issues: issues.filter((i) => i.status === s),
      }));
      return (
        <IssueBoard
          columns={columns}
          labels={labels}
          people={people}
          today="2026-11-17"
          defaultSelected="OPS-29"
          editors={{ status: { statuses: ORDER }, assignee: { me: "cr" } }}
          onIssueChange={(id, patch) =>
            setIssues((all) => all.map((i) => (i.id === id ? { ...i, ...patch } : i)))
          }
          rowMenu={() => [{ id: "copy", label: "Copy ID" }]}
          onRowAction={() => {}}
        />
      );
    }
    API → Props
    PropTypeDefaultDescription
    columns{ key, name, status?, glyph?, issues }[]—The columns in order, with the same issues as the list.
    labels{ value, label, color }[]—The labels issues refer to, with their names and colours.
    people{ id, name, src? }[]—The people issues are assigned to.
    todaystring—YYYY-MM-DD: earlier due dates read as overdue, in red.
    properties("id" | "priority" | "status" | "labels" | "due" | "assignee" | "author")[]all but authorWhat each issue shows. The author shows only when asked for.
    selected / defaultSelectedstring | null—The current issue, marked; the arrows move it. Controlled or not.
    onSelectedChange(id: string) => void—When the arrows or a click move the current issue.
    onOpen(id: string) => void—A click or Enter on an issue.
    collapsed / defaultCollapsedstring[]—The folded columns: a narrow strip, the name written down.
    onCollapsedChange(keys: string[]) => void—When a group is folded or opened.
    showCountsbooleanfalseThe number of issues next to a group's name. Off: no counters as chrome.
    onAdd(columnKey: string) => void—A + in each header and a New issue button at the end of each lane.
    onColumnMenu(columnKey: string) => void—A ⋯ in each header.
    renderExtra(issue) => ReactNode—More chips at the end of a card: a project, an estimate.
    onIssueChange(id: string, patch: Partial<IssueItem>) => void—Turns editing on: each shown property becomes the trigger of its picker. Absent: read-only.
    editors{ status?, priority?, labels?, assignee?, author?, due? }—Per property: false for read-only; options (statuses, names, people, me, noneLabel, labels, presets, clearable); render(issue, change) for your own. Author is read-only unless given.
    shortcutsbooleantrueS, P, A, L, D open the matching picker on the current issue while the block has the focus.
    rowMenu(issue) => ActionMenuEntry[]—The actions of an issue: right click, Shift+F10, or the ⋯ shown on hover.
    onRowAction(id: string, actionId: string) => void—The action chosen in rowMenu.
    classNamestring—Extra classes.