Resource schedule
Rows per person or resource over days: blocks as bars, clashes marked. A thin preset on the Timeline, not a second engine.
import { ResourceSchedule, scheduleConflicts, findConflicts } from "@forgeron/ui";// Leave and shifts per person; the two blocks of Ana that overlap are marked.
import { ResourceSchedule } from "@forgeron/ui";
const blocks = [
{
id: "1",
name: "Leave",
resource: "ana",
start: "2026-11-16",
end: "2026-11-20",
color: "var(--success)",
},
{
id: "2",
name: "Training",
resource: "ana",
start: "2026-11-19",
end: "2026-11-24",
color: "var(--accent)",
},
{
id: "3",
name: "Night shifts",
resource: "bob",
start: "2026-11-18",
end: "2026-11-22",
color: "var(--warning)",
},
];
export default function Leave() {
return (
<div style={{ width: "100%", height: 260, display: "flex", border: "1px solid var(--line)" }}>
<ResourceSchedule
resources={[
{ id: "ana", name: "Ana" },
{ id: "bob", name: "Bob" },
{ id: "cy", name: "Cy" },
]}
blocks={blocks}
today="2026-11-18"
defaultZoom="weeks"
labelWidth={160}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
resources | { id, name, glyph? }[] | — | One section each, initials in front by default. |
blocks | T[] | — | Leave, shifts, bookings: a row under their resource. |
getResource / getStart / getEnd | (record) => string | resource, start, end | Days are YYYY-MM-DD, last day included. |
getId / getLabel / getColor | (record) => string | id, title or name, color | As the Timeline. |
isShared | (record) => boolean | — | A block that may overlap others (a holiday) and is never a clash. |
onConflicts | (Map<id, id[]>) => void | — | The clashes, whenever they change. |
onChange | (id, { start, end }) => void | — | Drag or Alt and arrows, as the Timeline; the resource does not change. |
…Timeline props | zoom, today, selected, onOpen, collapsed, toolbar, labelWidth, renderBar… | — | All pass through. Timeline covers it: one bar per row, so several blocks of a resource are rows under its section. Hours of a day belong to the TimeGrid with resources. |