Calendar view
Records on the days of a month or a week, Monday first. Drag or Alt+arrows to move one.
import { CalendarView } from "@forgeron/ui";November 2026
Mon
Tue
Wed
Thu
Fri
Sat
Sun
import { CalendarView } from "@forgeron/ui";
const records = [
{ id: "OPS-40", title: "Supplier invoices", due: "2026-11-12", color: "var(--danger)" },
{ id: "OPS-38", title: "Signage audit", due: "2026-11-18", color: "var(--warning)" },
{ id: "OPS-37", title: "Carrier rates", due: "2026-11-18", color: "var(--accent)" },
{ id: "OPS-41", title: "Dock schedule", due: "2026-11-20" },
{ id: "OPS-35", title: "Safety walk", due: "2026-11-26", color: "var(--warning)" },
{ id: "OPS-30", title: "Archive notes", due: "2026-11-03", color: "var(--success)" },
];
export default function Month() {
return (
<div style={{ width: "100%", maxWidth: 720, border: "1px solid var(--line)" }}>
<CalendarView records={records} today="2026-11-18" modes={["month"]} />
</div>
);
}November 2026
Mon
Tue
Wed
Thu
Fri
Sat
Sun
// Issues from useListView placed on their due date. Drag one to another day, or focus it (Enter
// on a day) and press Alt and the arrows. "+n more" opens the week.
import {
CalendarView,
STATUS_NAMES,
useListView,
type IssueItem,
type StatusKind,
type ViewSpec,
} from "@forgeron/ui";
import { useState } from "react";
const COLORS: Partial<Record<StatusKind, string>> = {
progress: "var(--accent)",
review: "var(--warning)",
done: "var(--success)",
};
const initial: IssueItem[] = [
{ id: "OPS-40", title: "Supplier invoices arrive twice", status: "progress", due: "2026-11-18" },
{
id: "OPS-37",
title: "Carrier rates: import the new grid",
status: "progress",
due: "2026-11-18",
},
{ id: "OPS-38", title: "Fire exit signage audit", status: "review", due: "2026-11-18" },
{ id: "OPS-41", title: "Dock schedule for Lyon", status: "todo", due: "2026-11-18" },
{ id: "OPS-42", title: "Label printer jams on 4x6", status: "todo", due: "2026-11-18" },
{ id: "OPS-35", title: "Quarterly safety walk", status: "todo", due: "2026-11-24" },
{ id: "OPS-30", title: "Archive last year's delivery notes", status: "done", due: "2026-11-09" },
{ id: "OPS-33", title: "Badge readers at the Lyon dock", status: "backlog" },
];
const spec: ViewSpec<IssueItem> = {
read: (issue, field) => (field === "status" ? issue.status : null),
orderings: { status: (a, b) => STATUS_NAMES[a.status].localeCompare(STATUS_NAMES[b.status]) },
};
export default function MovableIssues() {
const [issues, setIssues] = useState(initial);
const [last, setLast] = useState("Drag an issue to another day");
const view = useListView(issues, spec, {
defaultDisplay: {
layout: "calendar",
grouping: "none",
ordering: "status",
toggles: {},
properties: [],
},
});
return (
<div style={{ width: "100%", display: "grid", gap: 12 }}>
<div style={{ border: "1px solid var(--line)" }}>
<CalendarView
records={view.records}
getColor={(i) => COLORS[i.status]}
today="2026-11-18"
onOpen={(id) => setLast(`Open ${id}`)}
onChange={(id, due) => {
setIssues((all) => all.map((i) => (i.id === id ? { ...i, due } : i)));
setLast(`${id} moved to ${due}`);
}}
/>
</div>
<span style={{ font: "400 11px/1 var(--font-mono)", color: "var(--ink-dim)" }}>{last}</span>
</div>
);
}Nov 16 – Nov 22, 2026W47
Mon
Tue
Wed
Thu
Fri
Sat
Sun
// One week with every record of each day, the week number beside the title.
import { CalendarView } from "@forgeron/ui";
const shifts = [
{ id: "1", name: "Inbound, Hugo", date: "2026-11-16", color: "var(--accent)" },
{ id: "2", name: "Inbound, Nadia", date: "2026-11-17", color: "var(--accent)" },
{ id: "3", name: "Inventory count", date: "2026-11-18", color: "var(--warning)" },
{ id: "4", name: "Inbound, Camille", date: "2026-11-18", color: "var(--accent)" },
{ id: "5", name: "Carrier visit", date: "2026-11-18" },
{ id: "6", name: "Fire drill", date: "2026-11-19", color: "var(--danger)" },
{ id: "7", name: "Inbound, Tom", date: "2026-11-20", color: "var(--accent)" },
{ id: "8", name: "Saturday pickup", date: "2026-11-21" },
];
export default function Week() {
return (
<div style={{ width: "100%", border: "1px solid var(--line)" }}>
<CalendarView records={shifts} today="2026-11-18" defaultMode="week" />
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
records | T[] | — | Records without a date are left out. |
getId | (record) => string | record.id | The key of a record. |
getLabel | (record) => string | title, else name | Its name, also said to assistive technology. |
getDate | (record) => string | null | due, else date | The day a record sits on, YYYY-MM-DD. |
getColor | (record) => string | undefined | record.color | A CSS colour for its mark, e.g. var(--accent). Grey without one. |
renderItem | (record) => ReactNode | — | The inside of an item. An issue's id and title by default. |
date / defaultDate | string | today | The day in focus: its month or week is shown. Controlled or not. |
onDateChange | (date) => void | — | When the day in focus moves. |
mode / defaultMode | "month" | "week" | "month" | A month with +n more, or a week with every record. Controlled or not. |
onModeChange | (mode) => void | — | When the mode changes. |
modes | CalendarMode[] | ["month", "week"] | The modes the toolbar offers. +n more opens the week when it is one. |
today | string | the device's date | YYYY-MM-DD: marked in ember. |
selected / defaultSelected | string | null | — | The current record, marked. Controlled or not. |
onSelectedChange | (id: string) => void | — | When the arrows or a click move the current record. |
onOpen | (id: string) => void | — | A click or Enter on a record. |
onChange | (id, date) => void | — | Makes records movable: drag to a day, or Alt+arrows on a record. |
maxPerDay | number | 3 | Records a day of the month shows before +n more. |
toolbar | boolean | true | Today and the zoom or mode above. Off when a display menu holds them. |
className | string | — | Extra classes. |