Skip to content

Components

TimeGrid: a week of time blocks, moved by drag or keys

TimeGrid lays out a week the way a calendar app does, days side by side and hours down the page, with each lesson, meeting or time entry as a block in its owner's hue. Blocks move to another time or day, change their length and are drawn in an empty stretch, by drag or with Alt and the arrow keys, in steps of 15 minutes.

By Bohuslav PoláčekChecked

Riverside's coaching week of 30 November 2026 on Wednesday 2 December at 10:24: 37 lessons in their coach's hue, two groups still without attendance, today in an ink pill and the now line; a phone shows today alone.

What it is for, and what the preview shows

Anything with a start and an end inside a day, seen a week at a time: lessons, meetings, time entries, posts. The preview is Riverside's coaching week as the demo shows it on Wednesday 2 December 2026 at 10:24, rebuilt from the kit with the demo's 37 lessons. Each lesson is a member's or a group's name over its court and coach, tinted in the coach's hue, so one coach's week reads as one colour while the words still say what each lesson is. The two group lessons that have gone without attendance say so first. Today's date sits in an ink pill, the weekend is on the quiet surface, each day's header counts its lessons, and the now line carries its time in the hour column.

The demo's day runs from 8:00 to 21:00 at the kit's 48px an hour, inside the hairline frame the demo gives the grid. Seven columns of names do not fit a phone, so the narrow preview shows Wednesday alone. The same grid draws Brightpath's time entries and, with neutral cards, Martin Kerr's week of posts.

The rules, and where they live

  • The manifest: use it for time entries, bookings or meetings by the hour; not for days of a month (MonthCalendar) and not for people by day (ScheduleGrid). It replaces "a hand-built week calendar" and "a calendar library".
  • AGENTS.md, Apps do work: planning views are editors: drag, quick add in an empty cell, copy, live feedback, the same from the keyboard.
  • AGENTS.md, Charts: timelines and calendars show now and today. The kit's now line is ink with a dot, because it marks a time, not a problem.
  • docs/principles.md: a calendar or a time grid that fills the page gets a hairline frame with the card radius, so it reads as one table; calendars scroll inside themselves and never scroll the page; a block that has no action has no hover and no focus.
  • docs/patterns.md, Time and planning: a week as a grid of time blocks, with Brightpath's time calendar as the example.
  • The props type: now is a prop, so the line sits where the app's clock says, in a test and a screenshot too.

What AI coding tools write instead

A calendar library, or a week of absolutely positioned boxes, as the manifest's replaces names them. What goes wrong:

  • The library brings its own look: its colours, its fonts and a red now line that reads as an error on an ordinary day.
  • Two lessons at the same time cover each other, so the second one disappears. The kit puts blocks that overlap side by side in the day's column.
  • A drag moves the block by pixels and the time is worked out after the drop, so a lesson lands a few minutes off the hour. The kit snaps to 15 minutes and shows the new times on the block while it moves.
  • A place that is not allowed is refused after the drop, if at all. With refuseChange the carried block turns to a danger ring with the reason in place of its times, and a drop there leaves it where it was.
  • Nothing works from the keyboard. Every kit block is a button named by its title, times and subtitle; Alt with the arrows moves it, adding Shift changes its end, and each step is announced.

How to use it

  • columns: id, label (the weekday), sublabel (the date, in an ink pill when today), muted for a day off and meta for a figure at the right of the header.
  • events: id, column, ISO start and end (null for a running timer), title, subtitle, hue for the owner's identity and locked for a block that opens but never moves.
  • startHour and endHour (7 to 19 by default), hourHeight (48px, or 64 where a block carries a three-line preview) and now from the app's clock.
  • onEventChange makes blocks drag and resize; onCreate draws a new one in an empty stretch, a plain click making 30 minutes; dayOf turns a column into its date.
  • refuseChange returns why a place is not allowed, and onRefuse tells the person.
  • content and resizable={false} turn it into a content calendar, where a post is a moment and its card shows what the app draws; empty says what to do in a week with nothing in it.

Its entry in the manifest

The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.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 TimeGrid, and the modules it sits in.Read from the demo's source when the site was built: 3 of 9 example apps render <TimeGrid>, in the modules named here as each app's sidebar names them.

How the demo calls it

apps/demo/src/modules/coaching/components/week-calendar.tsx
<TimeGrid
  // A hairline frame with the card radius around the grid (owner's remark, 27 Oct 2026): the week reads as one
  // table, and its own scroll stays inside the frame.
  className="min-h-0 flex-1 overflow-hidden rounded-xl hairline border-border"
  label={tx("Lekce týdne", "The week's lessons")}
  columns={days.map((key) => {
    const date = new Date(parseDay(key));
    const count = live.filter((lesson) => dayKey(lesson.start) === key).length;
    return {
      id: key,
      label: weekdayOf(date),
      sublabel: `${date.getDate()}.`,
      today: key === today,
      muted: date.getDay() === 0 || date.getDay() === 6,
      meta: count ? countLabel(count, ["lekce", "lekce", "lekcí"], ["lesson", "lessons"]) : undefined,
    };
  })}
  events={events}
  startHour={8}
  endHour={21}
  now={new Date(now)}
  // Local noon of the day, so the grid finds the same local day in any time zone.
  dayOf={(column) => new Date(parseDay(column) + 12 * 3_600_000).toISOString()}
  onEventClick={onOpen}
  onEventChange={planning?.onChange}
  onCreate={planning?.onCreate}
  empty={empty}
Riverside's coaching week: a column per day with its weekday, date and count of lessons, the weekend muted, the club's clock for now, and the editing handlers only when the person may plan.

Questions

Can a lesson be moved with the keyboard?

Yes. With a block focused, Alt and the up or down arrow move it by 15 minutes, Alt and Shift with the same arrows change its end, and Alt with the left or right arrow moves it to another day. Each step is announced, and a refused step says why.

How do I stop two lessons for the same coach?

Pass refuseChange. While a block is carried over a place the app does not allow, such as a coach who is already teaching, it turns to a danger ring and shows the reason; let go there and it stays where it was, and onRefuse can show a toast.

Does the grid read the clock?

Only when the app passes no now. Pass the app's own clock and the now line follows it, while today's pill follows the column the app marks as today, so a test or a screenshot draws the same week every time.

Can it show posts instead of time blocks?

Yes. A block without a hue is a neutral card, content replaces its title with the app's own preview, resizable set to false keeps every block's length, and an hourHeight of 64 gives a card room for three lines. Martin Kerr's content calendar uses it that way.

Two ways

Build it yourself, or have it built

  • Build it yourself

    Build your app on the framework

    Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.

    One payment, lifetime updates

    Get the framework
  • Have it built

    Have us build your app

    Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.

    After launch, Care keeps it improving, from €99 a month.

    from €1,990

    Describe your app