Blocks / Issue list

Issue list

Issues in foldable groups, one dense row each. Arrows move, Enter opens.

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

const people = [
  { id: "cr", name: "Camille Roy" },
  { id: "hb", name: "Hugo Bernard" },
  { id: "lm", name: "Léa Martin" },
];

export default function Default() {
  return (
    <div style={{ width: 300 }}>
      <IssueList
        people={people}
        properties={["priority", "id", "status", "assignee"]}
        defaultSelected="OPS-40"
        groups={[
          {
            key: "progress",
            name: "In Progress",
            status: "progress",
            issues: [
              {
                id: "OPS-40",
                title: "Supplier invoices arrive twice from Odoo",
                status: "progress",
                priority: 1,
                assignee: "hb",
              },
              {
                id: "OPS-37",
                title: "Carrier rates: import the new grid",
                status: "progress",
                priority: 2,
                assignee: "cr",
              },
              {
                id: "OPS-29",
                title: "Quarterly safety walk, Lyon",
                status: "progress",
                priority: 3,
                assignee: "lm",
              },
            ],
          },
        ]}
      />
    </div>
  );
}
/02 → Grouped by status
    Click a row or a +
    import { IssueList } 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 GroupedByStatus() {
      const [last, setLast] = useState("Click a row or a +");
      return (
        <div style={{ width: "100%", display: "grid", gap: 12 }}>
          <IssueList
            labels={labels}
            people={people}
            today="2026-11-17"
            showEmptyGroups
            defaultCollapsed={["done"]}
            onAdd={(group) => setLast(`New issue in ${group}`)}
            onOpen={(id) => setLast(`Open ${id}`)}
            groups={[
              {
                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"],
                    due: "2026-11-20",
                    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: "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: "backlog", name: "Backlog", status: "backlog", issues: [] },
              {
                key: "done",
                name: "Done",
                status: "done",
                issues: [
                  {
                    id: "OPS-33",
                    title: "Badge readers at the Lyon dock",
                    status: "done",
                    priority: 2,
                  },
                ],
              },
            ]}
          />
          <span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>{last}</span>
        </div>
      );
    }
    /03 → By assignee
    CURRENT: OPS-36 · ↑ ↓ TO MOVE
    import { Avatar, IssueList } from "@forgeron/ui";
    import { useState } from "react";
    
    const people = [
      { id: "cr", name: "Camille Roy" },
      { id: "hb", name: "Hugo Bernard" },
    ];
    
    export default function ByAssignee() {
      const [selected, setSelected] = useState<string | null>("OPS-36");
      return (
        <div style={{ width: "100%", display: "grid", gap: 12 }}>
          <IssueList
            people={people}
            properties={["priority", "id", "status", "due"]}
            today="2026-11-17"
            selected={selected}
            onSelectedChange={setSelected}
            groups={[
              {
                key: "cr",
                name: "Camille Roy (you)",
                glyph: <Avatar name="Camille Roy" size={16} />,
                issues: [
                  {
                    id: "OPS-36",
                    title: "Carrier rates: import the new grid",
                    status: "progress",
                    priority: 2,
                    due: "2026-11-20",
                  },
                  {
                    id: "OPS-22",
                    title: "Renew the forklift inspection",
                    status: "todo",
                    priority: 1,
                    due: "2026-11-16",
                  },
                ],
              },
              {
                key: "hb",
                name: "Hugo Bernard",
                glyph: <Avatar name="Hugo Bernard" size={16} />,
                issues: [
                  {
                    id: "OPS-40",
                    title: "Supplier invoices arrive twice from Odoo",
                    status: "review",
                    priority: 1,
                  },
                ],
              },
            ]}
          />
          <span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>
            CURRENT: {selected ?? "NONE"} · ↑ ↓ TO MOVE
          </span>
        </div>
      );
    }
    /04 → Editable
    • Priority
      OPS-40
      Status
      Supplier invoices arrive twice from Odoo
      Labels
      Author
      Assignee
    • Priority
      OPS-37
      Status
      Carrier rates: import the new grid
      Labels
      Author
      Assignee
    • Priority
      OPS-29
      Status
      Quarterly safety walk, Lyon
      Author
      Assignee
      Labels
    Click a mark, or select a row and press S, P, A, L or D
    import { IssueList, 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: "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" },
    ];
    const start: IssueItem[] = [
      {
        id: "OPS-40",
        title: "Supplier invoices arrive twice from Odoo",
        status: "progress",
        priority: 1,
        labels: ["bug", "customer"],
        due: "2026-11-12",
        assignee: "hb",
        author: "cr",
      },
      {
        id: "OPS-37",
        title: "Carrier rates: import the new grid",
        status: "todo",
        priority: 2,
        labels: ["feature"],
        due: "2026-11-20",
        assignee: "cr",
        author: "lm",
      },
      {
        id: "OPS-29",
        title: "Quarterly safety walk, Lyon",
        status: "backlog",
        assignee: null,
        author: "np",
      },
    ];
    const ORDER = ["progress", "todo", "backlog", "done"] as const;
    const NAMES = { progress: "In Progress", todo: "Todo", backlog: "Backlog", done: "Done" };
    
    export default function Editable() {
      const [issues, setIssues] = useState(start);
      const [last, setLast] = useState("Click a mark, or select a row and press S, P, A, L or D");
      const groups: IssueGroup[] = ORDER.map((s) => ({
        key: s,
        name: NAMES[s],
        status: s,
        issues: issues.filter((i) => i.status === s),
      }));
      return (
        <div style={{ width: "100%", display: "grid", gap: 12 }}>
          <IssueList
            groups={groups}
            labels={labels}
            people={people}
            today="2026-11-17"
            defaultSelected="OPS-40"
            properties={["priority", "id", "status", "labels", "author", "assignee", "due"]}
            editors={{
              status: { statuses: ["backlog", "todo", "progress", "done"] },
              assignee: { me: "cr" },
              author: { me: "cr" },
            }}
            onIssueChange={(id, patch) => {
              setIssues((all) => all.map((i) => (i.id === id ? { ...i, ...patch } : i)));
              setLast(`${id}: ${Object.keys(patch).join(", ")} changed`);
            }}
            onOpen={(id) => setLast(`Open ${id}`)}
          />
          <span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>{last}</span>
        </div>
      );
    }
    /05 → Row menu
    • Urgent priorityOPS-40In ProgressSupplier invoices arrive twice from Odoo
    • High priorityOPS-37TodoCarrier rates: import the new grid
    • Medium priorityOPS-29BacklogQuarterly safety walk, Lyon
    Right-click a row, press Shift+F10, or use its ⋯
    import { ArrowUpRight01Icon, Copy01Icon, Delete02Icon } from "@forgeron/icons";
    import { IssueList, StatusGlyph, type ActionMenuEntry, type IssueItem } from "@forgeron/ui";
    import { useState } from "react";
    
    const start: IssueItem[] = [
      {
        id: "OPS-40",
        title: "Supplier invoices arrive twice from Odoo",
        status: "progress",
        priority: 1,
      },
      { id: "OPS-37", title: "Carrier rates: import the new grid", status: "todo", priority: 2 },
      { id: "OPS-29", title: "Quarterly safety walk, Lyon", status: "backlog", priority: 3 },
    ];
    const STATES = ["backlog", "todo", "progress", "done"] as const;
    const NAMES = { backlog: "Backlog", todo: "Todo", progress: "In Progress", done: "Done" };
    
    const menuOf = (issue: IssueItem): ActionMenuEntry[] => [
      {
        id: "status",
        label: "Status",
        glyph: <StatusGlyph status={issue.status} />,
        items: STATES.map((s) => ({
          id: `status:${s}`,
          label: NAMES[s],
          glyph: <StatusGlyph status={s} />,
          checked: issue.status === s,
        })),
      },
      { separator: true },
      { id: "open", label: "Open issue", icon: ArrowUpRight01Icon, kbd: "↵" },
      { id: "copy", label: "Copy ID", icon: Copy01Icon },
      { separator: true },
      { id: "delete", label: "Delete issue", icon: Delete02Icon, danger: true },
    ];
    
    export default function RowMenu() {
      const [issues, setIssues] = useState(start);
      const [last, setLast] = useState("Right-click a row, press Shift+F10, or use its ⋯");
      return (
        <div style={{ width: "100%", display: "grid", gap: 12 }}>
          <IssueList
            groups={[{ key: "all", name: "All issues", issues }]}
            properties={["priority", "id", "status"]}
            rowMenu={menuOf}
            onRowAction={(id, action) => {
              if (action.startsWith("status:")) {
                const status = action.slice(7) as IssueItem["status"];
                setIssues((all) => all.map((i) => (i.id === id ? { ...i, status } : i)));
              }
              if (action === "delete") setIssues((all) => all.filter((i) => i.id !== id));
              setLast(`${action} on ${id}`);
            }}
            onOpen={(id) => setLast(`Open ${id}`)}
          />
          <span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>{last}</span>
        </div>
      );
    }
    API → Props
    PropTypeDefaultDescription
    groups{ key, name, status?, glyph?, issues }[]—The groups in order. An issue: { id, title, status, priority?, labels?, due?, assignee?, author? }.
    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 keys of the folded groups. Controlled or not.
    onCollapsedChange(keys: string[]) => void—When a group is folded or opened.
    showEmptyGroupsbooleanfalseShows a group with no issue.
    showCountsbooleanfalseThe number of issues next to a group's name. Off: no counters as chrome.
    onAdd(groupKey: string) => void—Adds a + to each group's header.
    emptyReactNode"No issues here yet"Shown when no group has an issue.
    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.