# ResourceTimeline: bookings across resources, hour by hour

ResourceTimeline lays out resources as rows and a day's hours across, with each booking or job as a block that moves, stretches and is drawn by drag or from the keyboard. It refuses a block that would land on another one and says why before the hand lets go, and it marks now with an ink line and its time.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/resource-timeline/

*Riverside's courts on Wednesday 2 December 2026 at 10:24: bookings played or on court with a check, closed courts striped grey, confirmed ones in their court's hue, and the now line; a phone shows the hour and a half from 10:00.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/resource-timeline/

## What it is for, and what the preview shows

Anything that takes a place for a time: courts and their bookings, loading bays and trucks, machines and jobs. The preview is [Riverside](https://meadowstack.com/examples/sports-club-court-bookings/)'s reception as the demo shows it on Wednesday 2 December 2026 at 10:24: seven courts and the day's bookings, rebuilt from the kit with the demo's records. Bookings already played carry a check, three are on court, clay court maintenance and a lighting repair are blocked time, and the rest are confirmed, tinted in their court's hue. Later in the day two unpaid bookings are dashed and pale, and a cancelled one is struck through.

The demo's day runs from 7:00 to 22:00 at the kit's 120px an hour, so the wide preview shows the morning around now, as the app opens. A phone has room for an hour and a half beside the 176px court column, so the narrow preview starts at 10:00; the demo shows a phone a list of the day's bookings instead. The screen around it is [court bookings](https://meadowstack.com/screens/court-bookings/).

## The rules, and where they live

- **The manifest**: use it for bookings or machine time across resources within a day; not for a project over weeks (`GanttChart`) and not for people by day (`ScheduleGrid`). It replaces "a hand-built timeline grid".
- **AGENTS.md, Apps do work**: planning views such as rotas, machines and bookings are editors: drag, quick add in an empty cell, copy, live feedback, and the same from the keyboard.
- **AGENTS.md, Charts**: timelines and calendars show now and today, with the line under the blocks. Here it is ink with its time, because it marks a time, not a problem.
- **AGENTS.md, Look and feel**: colour carries a status or an identity. The court's hue is its identity; blocked time is striped grey and never coloured; a status also changes the block's shape (a check, a dashed edge, a line through).
- **docs/patterns.md, Time and planning**: rows of resources over a day or a week with the nights left out; drag, resize, a now line, conflicts said aloud.
- **scripts/check-contrast.mjs**: every hue's text holds 4.5:1 on its tint and on white, in light and dark, so a block's words are never faded to fit.

## What AI coding tools write instead

A grid of absolutely positioned boxes, placed by minutes since midnight, as the manifest's `replaces` names it. What goes wrong:

- Two bookings can land on the same court at the same time, because nothing checks for overlap while the block is carried. The kit refuses it, turns the block red with "Something is already here" or the app's own reason from `refuse`, and sends it back.
- The now line is red, which reads as an error on a normal day.
- A status is a colour alone, so unpaid and confirmed look alike to a person who cannot tell the two hues apart.
- Short blocks cut their names. The kit lets a block grow to its words on hover or focus, up to 320px, above its neighbours.
- The grid scrolls with `overflow-auto`, which `scripts/check-markup.mjs` flags as `own-scroll`, and there is no way to move a booking without a mouse.

## How to use it

- `resources`: `id`, `label`, `hint` (the line under the name, such as the surface) and `hue`.
- `blocks`: `resourceId`, ISO `start` and `end`, `title`, `subtitle` and a `status`: `confirmed`, `tentative`, `checked-in`, `cancelled` or `blocked`.
- `day`, `startHour` and `endHour`; `days` and `hiddenDays` for a week of working days with the nights left out.
- `step` (30 minutes by default, the unit bookings are sold in) and `pxPerHour` (120 by default).
- `now`: pass the app's clock, so the line sits where the app thinks it is.
- `onMove(id, resourceId, start, end)` and `onCreate(resourceId, start, end)`. Without them a block only opens; a booking that cannot move simply gets no handler.
- `refuse` returns why a place is not allowed, and `onRefuse` tells the person; `onSelect` and `selectedId` connect the side panel.

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | ResourceTimeline |
| --- | --- |
| What it is | Resources (courts, machines, rooms) as rows with blocks over a day's hours, dragged and resized. |
| Use it for | Bookings or machine time across resources within a day. |
| Not for | For a project over weeks (GanttChart); For people by day (ScheduleGrid) |
| It replaces | A hand-built timeline grid |
| Screen types | Workspace |
| Import | `import { ResourceTimeline } from "@meadowstack-studio/kit";` |

Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

## Where it runs in the example apps

*The example apps whose code renders a ResourceTimeline, and the modules it sits in.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | Jobs |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | Freight |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Front desk |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Machines |

Read from the demo's source when the site was built: 4 of 9 example apps render <ResourceTimeline>, in the modules named here as each app's sidebar names them.

## How the demo calls it

*Riverside's reception: the courts as resources with their surface and hue, the day from 7:00 to 22:00, and moving or drawing a booking only for people allowed to book.*

From `apps/demo/src/modules/desk/pages/bookings.tsx` in the Meadowstack repository:

```tsx
<ResourceTimeline
  label={`${tx("Rezervace kurtů", "Court bookings")}, ${dayLabel(day)}`}
  resources={view.courts.map((court) => ({
    id: court.id,
    label: court.name,
    hint: court.surface,
    hue: court.hue,
  }))}
  blocks={blocks}
  day={day}
  startHour={7}
  endHour={22}
  selectedId={selectedId}
  onSelect={(id) =>
    view.bookings.some((item) => item.id === id) ? setParam("rezervace", id) : undefined
  }
  onMove={can("desk.book") ? (id, courtId, start, end) => void move(id, courtId, start, end) : undefined}
  onCreate={
    can("desk.book")
      ? (courtId, start, end) =>
          setCreating({
            courtId,
            start,
            minutes: (new Date(end).getTime() - new Date(start).getTime()) / 60_000,
          })
      : undefined
  }
/>
```

## Questions

### Can a booking be dragged with the keyboard?

Yes. Blocks are buttons in time order. The left and right arrows move a booking by half an hour, Shift by an hour, and up and down move it to another court. Enter opens it, and every move is announced.

### How does it stop double bookings?

While a block is carried, the timeline checks the place under it. Over another block it turns red and says that something is already there; let go and it returns. The app can add its own reasons, such as a court closed for a league match.

### Can it show a whole week of machines?

Yes. With days set, each day shows its working hours side by side with the hours between left out, and hiddenDays leaves out the weekend. Shift with an arrow then moves a block by a day.

### What do the block styles mean?

Confirmed is tinted with a solid edge in the resource's hue, tentative is dashed and pale, checked in adds a check, cancelled is struck through in grey, and blocked time is striped grey.

## Related

- [Court bookings on a timeline you drag](https://meadowstack.com/screens/court-bookings/) (Screens)
- [GanttChart: a project schedule with its links and key dates](https://meadowstack.com/components/gantt-chart/) (Components)
- [MonthCalendar: a month of things you move between days](https://meadowstack.com/components/month-calendar/) (Components)
- [SortableBoard: a kanban board that works from the keyboard](https://meadowstack.com/components/sortable-board/) (Components)
- [TimeGrid: a week of time blocks, moved by drag or keys](https://meadowstack.com/components/time-grid/) (Components)
- [The planning editor](https://meadowstack.com/patterns/planning-editor/) (Patterns)
