Views

Week and day

The Solid week and day views, time grids with an all-day row, a current-time line and DST-aware hours, from the Solid registry.

Live. The page that Add them builds, with a standup and a two-day conference in October 2026. Drag an event to move it, or drag across empty time to create one.

The Solid demo opens on the week, with more events and a toolbar.

createWeekView and createDayView show the hours of the day down the side and one column per day. The week view has seven columns, starting on weekRules.firstDay. The day view has one column for the anchor date. createThreeDayView has three, from the anchor date: on a phone, where a week's seven columns are too narrow to read, it shows more than a day. The scrolling week and day swipe sideways through the days a page at a time.

Add them

Add the time-grid-view item to your app with the shadcn CLI, as UI source describes. It brings the theme, the shared calendar parts and the kit's tooltip:

npx shadcn@latest add @moltenship/time-grid-view

Then register the views:

calendar.tsx
import {
  createCalendar,
  createCanonicalEventAdapter,
  type CalendarEvent,
  type CalendarEventChange,
} from "@moltenship/calendar-solid";
import { createSignal } from "solid-js";

import type { CalendarEventColor } from "@/components/calendar/event-colors";
import { createDayView, createWeekView } from "@/components/calendar/time-grid-view/time-grid-view";

export type Event = CalendarEvent<{ readonly color: CalendarEventColor }>;

const getEventColor = (event: Event) => event.data.color;

export const Calendar = createCalendar<Event>()({
  eventAdapter: createCanonicalEventAdapter<{ readonly color: CalendarEventColor }>(),
  views: [
    createWeekView<Event>({ dayView: "day", getEventColor }),
    createDayView<Event>({ getEventColor }),
  ],
});

The views are named week, day and 3-day. Previous and Next move by a week, a day or three days. The hours scroll inside the height they're given, so give Calendar.Viewport a height, and save the changes a drag or a key proposes in onEventChange:

week-page.tsx
export default function WeekPage() {
  const [events, setEvents] = createSignal<readonly Event[]>(seed);
  // A drag or a key proposes a change; saving it moves the event.
  const save = (change: CalendarEventChange<Event, string, string>) => {
    if (change.cause === "create") {
      const event: Event = {
        data: { color: "blue" },
        id: crypto.randomUUID(),
        title: "New event",
        ...change.proposed,
      };
      setEvents((all) => [...all, event]);
    } else if (change.cause !== "delete") {
      setEvents((all) =>
        all.map((event) =>
          event.id === change.eventId ? { ...event, ...change.proposed } : event,
        ),
      );
    }
  };
  return (
    <Calendar.Root
      defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
      defaultTimeZone="UTC"
      defaultView="week"
      events={events()}
      locale="en-US"
      onEventChange={save}
      weekRules={{ firstDay: 1, minimalDays: 4, weekend: [6, 7] }}
    >
      {/* The hours scroll inside the viewport, under the header and the all-day row. */}
      <Calendar.Frame class="flex h-dvh flex-col">
        <h1 class="p-4 text-lg font-semibold">
          <Calendar.Title />
        </h1>
        <Calendar.Viewport class="min-h-0 flex-1">
          <Calendar.ActiveView />
        </Calendar.Viewport>
      </Calendar.Frame>
    </Calendar.Root>
  );
}

Options

Pass them to createWeekView, createDayView or createThreeDayView, or per root in viewOptions, such as viewOptions={{ week: { overlapLayout: "stack" } }}:

Prop

Type

What it shows

  • Header: the weekday and date of each column, with today highlighted and marked aria-current="date". The corner shows the time zone's offset, such as "GMT+2", after the name of each secondary time zone.
  • All-day row: all-day events, plus timed and floating events that last 24 hours or more. Busy days collapse to three rows with "+N more", and a chevron in the corner expands the row.
  • Hours: labels come from Intl, so they read "1 PM" or "13:00" depending on the locale. Each hour is --calendar-hour-height tall (3rem by default).
  • Events: overlapping events sit side by side, or as overlapLayout sets. Events shorter than 45 minutes show on one line, as "Standup, 9:30 AM". Events that run past midnight show their real times on both days, as "10:00 PM – 2:00 AM". A title that doesn't fit its event shows in full in the kit's tooltip while you hover or focus the event.
  • Working hours: time outside the root's availability is shaded, and a focused slot there says "outside working hours". See Annotations and working hours.
  • Annotations: the root's annotations, such as sleep or listening history, draw in a rail at the start of each day, and an event beside a mark moves aside for it.
  • Daylight saving time: hours skipped when the clocks go forward are hatched, and hours repeated when they go back are tinted, with both occurrences side by side.
  • Current time: a line across today's column, from useNow(). The grid opens scrolled to the current time, or to 08:00 when today isn't visible, and keeps its scroll position when you move between weeks.
  • Editing: with onEventChange on Root, drag an event to move it (onto the all-day row to make it all-day), drag its top or bottom edge to resize it, and drag across empty time or all-day cells to create one. See Interactions.
  • Changes being saved: events with a pending change, the ones useCalendarPendingChanges returns, get aria-busy and render at 60% opacity.
  • On a phone every event and button is at least 24 px wide, and a long press doesn't select text. The 3-day view fits a phone better than the week.
  • Right to left mirrors the grid, the hours and the events' borders included, when the page or Calendar.Frame has dir="rtl".
  • Reduced motion opens the tooltip without its scale and slide.

Annotations and working hours

Live. Sleep and a listening session beside the events, and the time outside 9 to 5 shaded. Hover a mark to see what it is, or click it for the details.

The week and day draw the root's annotations as soon as Root has annotationSources, and shade the time outside its availability:

week-annotations.tsx
const time = (value: string) => Temporal.PlainTime.from(value);

// Weekdays 9 to 5; the weekend is closed.
const officeHours: CalendarAvailability = {
  weekly: [{ days: [1, 2, 3, 4, 5], start: time("09:00"), end: time("17:00") }],
};

export default function WeekAnnotations() {
  return (
    <Calendar.Root
      annotationSources={sources}
      annotations={annotations}
      availability={officeHours}
      defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
      defaultTimeZone="UTC"
      defaultView="week"
      events={events}
      locale="en-US"
      weekRules={{ firstDay: 1, minimalDays: 4, weekend: [6, 7] }}
    >
      <Calendar.Frame class="flex h-dvh flex-col">
        <Calendar.Viewport class="min-h-0 flex-1">
          <Calendar.ActiveView />
        </Calendar.Viewport>
      </Calendar.Frame>
    </Calendar.Root>
  );
}

Give each source a color from the event palette and an Icon, and its marks draw as capsules in that color with the icon inside their top:

week-annotations.tsx
function MoonIcon(props: { readonly class?: string }) {
  return (
    <svg class={props.class} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
      <path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />
    </svg>
  );
}

function MusicIcon(props: { readonly class?: string }) {
  return (
    <svg class={props.class} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
      <path d="M9 18V5l12-2v13" />
      <circle cx="6" cy="18" r="3" />
      <circle cx="18" cy="16" r="3" />
    </svg>
  );
}

const sources: readonly TimeGridAnnotationSource[] = [
  { id: "sleep", label: "Sleep", color: "purple", Icon: MoonIcon },
  {
    id: "music",
    label: "Music",
    color: "green",
    Icon: MusicIcon,
    // Tracks less than five minutes apart draw as one listening session.
    mergeGap: Temporal.Duration.from({ minutes: 5 }),
  },
];
  • Marks sit in a rail at the start of each day column, 18px wide in the week and 30px in the day. An event moves aside only where a mark is beside it. Hovering a mark shows a tooltip, and clicking it opens a popover of everything it merges. Annotations has the rail's options and parts.
  • Closed time is a band of --calendar-unavailable behind the events, one per stretch: evenings, nights and the weekend here. Availability restyles it or draws your own.
  • Screen readers hear both in words instead: a day's header summarizes its annotations, and a focused slot names the items across it and says when it's outside working hours.

Overlapping events

overlapLayout sets how events that overlap share a day column:

  • "columns" (the default) puts overlapping events side by side, in as few lanes as they need. Each event widens into lanes that stay free beside it.
  • "equal" uses the same lanes, but every event in a busy stretch is one lane wide, so the lanes line up.
  • "stack" cascades them. Each event is indented past the earlier events it overlaps and drawn on top of them, reaching to the column's end. stackIndent sets the indent. A deep stack indents less, so the top event keeps at least half the column.

getEventOverlapLayout gives events a layout of their own, usually their calendar's, and returns undefined for events that follow the view's. A group of overlapping events takes its events' own layout only when they all agree, and otherwise the view's overlapLayout.

Every layout keeps the same rules:

  • Events that touch, one ending as the next starts, don't overlap. An event shorter than 15 minutes still takes up 15 so it stays readable, so it can overlap the next one.
  • Overlapping events form a group, laid out on its own, so a change to one group never moves events in another.
  • The order is fixed: by start, then longer first, then event ID. It's the order events are drawn in.

Secondary time zones

Pass secondaryTimeZones to Root to label the hours in other time zones too, such as secondaryTimeZones={["America/New_York", { timeZone: "Asia/Tokyo", label: "Tokyo" }]}. Each zone gets a column of hours beside the calendar's own.

  • Names: each column is named by its label, or by the zone's short name from Intl in the calendar's locale, such as "EDT" or "GMT+5:30". Without a label, hover it for the zone's full name.
  • Hours: each line is read on its own date, in both zones' rules, so the labels stay right when either zone changes its clocks. Zones off the hour show minutes, such as "4:30 PM" in India. "+1" or "-1" marks a time on the next or previous day there.
  • Daylight saving time: an hour the calendar's zone skips has no label, and an hour it repeats shows its first time. A day that reads differently, because a zone changes its offset, says so under its date, such as "EST -1h". Hover the note to see from when, and until when if it ends that day.
  • Width: each zone's column is --calendar-zone-width wide, 4rem by default, which fits "12:30 AM+1". Set the variable on an element around the calendar for a locale that writes longer times, such as [--calendar-zone-width:4.5rem].
  • Screen readers: the extra hours are hidden, like the calendar's own hour labels, so the grid's columns stay the same.

Time and time zones explains how each line is read.

Anatomy

All three views render TimeGridView, with seven day columns for the week, three for the 3-day view and one for the day. The view builds these parts itself from its projection, so they're not parts you compose: to change one, edit its file under components/calendar/time-grid-view.

Rendered by TimeGridView
TimeGridView                     time-grid-view.tsx, a grid
├── TimeGridHeader               time-grid-header.tsx, the time zone and each day
├── TimeGridAllDay               time-grid-all-day.tsx, the all-day row
│   ├── AllDayRowHeader          "All day", and the chevron that expands the row
│   └── AllDayCell               a gridcell per day; its drop layer has data-date and data-all-day
│       ├── AllDayEvent          one per event in the row
│       └── "+N more"            expands the row
└── TimeGridBody                 time-grid-body.tsx, scrolls
    ├── Time gutter              --calendar-gutter-width
    │   └── TimeGridZoneHours    time-grid-zones.tsx, one per secondary time zone
    └── TimeGridColumn           time-grid-column.tsx, one per day, data-date
        ├── TimeGridAvailability time-grid-availability.tsx, closed time behind events
        ├── TimeGridAnnotations  time-grid-annotations.tsx, the rail of marks, or yours
        ├── TimeGridEvent        time-grid-event.tsx
        │   ├── Title and time
        │   └── Resize handles   data-resize="start" and "end"
        ├── Draft                data-slot="time-grid-draft", a keyboard create's range
        ├── Slot                 the focused 15-minute slot, while one has focus
        └── Now line             data-slot="time-grid-now"

The .tsx files are Solid components. What they draw comes from plain TypeScript beside them:

FileHolds
time-grid.styles.tsEvery class the parts set, so a restyle is one file
time-grid-labels.tsThe dates, hours, ranges and names the parts show and read out
time-grid-geometry.tsWhere an event, a gap or a fold sits in its column, and where the grid opens scrolled
all-day-layout.tsWhich all-day events fit in a collapsed row, and how many each day hides
secondary-zones.tsEach zone's hours, names and the notes under a day whose times differ
annotation-layout.tsThe rail's size, where its marks sit, and which events move aside for them
annotation-label.tsWhat a day's header and a focused slot say about the annotations
  • The gutter is --calendar-gutter-width wide: --calendar-hours-width for the hours (3rem, or 4rem from the sm breakpoint), plus --calendar-zone-width for each secondary time zone.
  • An event's top and height come from its times, and its left and width from the overlap layout. A column renders its events in layout order, so a stacked event draws over the ones it overlaps.
  • The grid shares one tooltip among its events, so a week of events renders one tooltip, not one each.

Keyboard

The grid is one tab stop. The Accessibility page has the full map and what a screen reader hears.

FocusKeyEffect
An all-day cell↓First slot of the day
A slot↑ ↓Previous or next 15-minute slot. Up from the first slot reaches the all-day cell
A day or slot← →Same slot on the previous or next day
A day or slotHome, EndFirst or last day shown
A day or slotPage Up, Page DownBack or forward a whole week (or day)
A slotEnterThe event covering it. Escape goes back to the slot it starts in
An all-day cellEnterGo into the day's all-day events
A timed event↑ ↓, ← →Previous or next event in the column, or the event beside it that overlaps it
A day or slotShift+EnterOpen that date in the day view, when the week has dayView
A slotSpaceStart an hour-long event there. Arrow keys extend it, and Enter saves it
An all-day cellSpaceStart an all-day event there
An eventSpacePick it up. Arrow keys move it by slots and days, Enter saves, and Escape cancels
An eventShift+SpacePick up its end to resize it. Shift+Space again switches to its start

Moving a picked-up timed event above the first slot makes it all-day, and moving an all-day event below the all-day row makes it timed. Only the focused slot is an element, so a week's 672 slots cost nothing until you visit them. After a drop, focus stays on the moved event.

Markup for interactions

The view connects the pointer layer for you. If you change its markup, keep the attributes the pointer layer reads: day columns have data-date and cover the full 24 hours, each all-day cell's drop layer has data-date and data-all-day, each event is a <button> with data-event-id, and events you can edit have data-resize="start" and data-resize="end" handles.

On this page