Quick start

Build a Solid calendar with a toolbar and an agenda view you write, showing your own meetings.

You'll build a calendar in SolidJS 2: a toolbar with previous, next and today buttons, a title, and an agenda of your own meetings. The agenda is a Solid component you write, so you see how a view is made: it draws a layout the engine computes. The registry has a styled agenda to add instead, and the week and day, the month, the year, the scrolling views and the resource columns, with a toolbar and a mini month. calendar-full installs every one of them, as Installation shows.

The Solid demo is a running calendar on the registry's views, the React demo's app in Solid. Its source is the repository's apps/demo-solid.

Install

Install @moltenship/calendar-solid and its peer dependencies as Installation describes, and set up the Solid compiler as Build setup shows.

Create the calendar

One file holds the three things a calendar is made of:

  • An adapter. defineEventAdapter says how to read an ID, a title and a time range from your records. Meeting here is the app's own type.
  • A view. defineCalendarView takes a name, a strategy and a Renderer. The strategy picks the dates and lays out the events. This one uses the engine's list functions, and projectList returns the days with their events. Agenda is the Renderer, a Solid component that draws that projection.
  • The calendar. createCalendar returns Calendar, the parts and hooks typed for your records. The first view in the list is shown first.
calendar.tsx
import {
  createCalendar,
  defineCalendarView,
  defineEventAdapter,
  getListRange,
  getListTitle,
  navigateList,
  projectList,
  type CalendarEventInterval,
  type CalendarViewRendererProps,
  type ListProjection,
  type ListViewOptions,
} from "@moltenship/calendar-solid";
import { For } from "solid-js";

export interface Meeting {
  readonly id: string;
  readonly title: string;
  readonly interval: CalendarEventInterval;
}

export const eventAdapter = defineEventAdapter<Meeting>()({
  getId: (meeting) => meeting.id,
  getTitle: (meeting) => meeting.title,
  getInterval: (meeting) => meeting.interval,
  getResourceIds: () => [],
});

type List = ListProjection<Meeting, string, string>;

// Props are getters in Solid: read `props.projection` in the JSX, and don't destructure it.
function Agenda(props: CalendarViewRendererProps<List, ListViewOptions>) {
  const day = (date: Temporal.PlainDate) =>
    date.toLocaleString(props.environment.locale, { dateStyle: "full" });

  return (
    <For each={props.projection.days} fallback={<p>Nothing in these weeks.</p>}>
      {(entry) => (
        <section>
          <h3>{day(entry.date)}</h3>
          <ul>
            <For each={entry.items}>
              {(item) => <li data-event-id={item.event.id}>{item.event.title}</li>}
            </For>
          </ul>
        </section>
      )}
    </For>
  );
}

export const listView = defineCalendarView({
  name: "list",
  defaultOptions: { weeks: 2 } as ListViewOptions,
  strategy: {
    getRange: (anchor, environment, options) => getListRange(anchor, environment, options),
    getTitle: (range, environment) => getListTitle(range, environment),
    navigate: (anchor, delta, options) => navigateList(anchor, delta, options),
    project: (input) => projectList(input) as List,
  },
  Renderer: Agenda,
});

export const Calendar = createCalendar<Meeting>()({ eventAdapter, views: [listView] });

export type View = (typeof Calendar.views)[number]["name"];

A Renderer's props are getters, as every Solid component's are. Read props.projection where it's used, and don't destructure it.

Render it

Root takes your events and the handler that saves a change. The events live in a signal of yours, and the calendar never stores them. Pass the signal's value: events={meetings()}.

app.tsx
import type { CalendarProposalDetail, CalendarWeekRules } from "@moltenship/calendar-solid";
import { createSignal } from "solid-js";

import { Calendar, type Meeting } from "./calendar";

const timeZone = "Europe/Berlin";
const at = (value: string) =>
  Temporal.PlainDateTime.from(value).toZonedDateTime(timeZone).toInstant();

export const seed: readonly Meeting[] = [
  {
    id: "standup",
    title: "Standup",
    interval: { kind: "timed", start: at("2026-10-08T09:00"), end: at("2026-10-08T09:30") },
  },
];

export const weekRules: CalendarWeekRules = { firstDay: 1, minimalDays: 4, weekend: [6, 7] };

// A title an agent sent with `createEvent` or `updateEvent`. A person's gesture sends none.
function titleFrom(detail: CalendarProposalDetail): string | undefined {
  const title = detail.fields?.title;
  return typeof title === "string" && title.trim() !== "" ? title.trim() : undefined;
}

export function App() {
  const [meetings, setMeetings] = createSignal<readonly Meeting[]>(seed);

  return (
    <Calendar.Root
      label="Team calendar"
      events={meetings()}
      defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
      defaultTimeZone={timeZone}
      locale="en-US"
      weekRules={weekRules}
      onEventChange={(change, detail) => {
        const title = titleFrom(detail);
        if (change.cause === "delete") {
          setMeetings((current) => current.filter((meeting) => meeting.id !== change.eventId));
        } else if (change.cause === "create") {
          setMeetings((current) => [
            ...current,
            { id: crypto.randomUUID(), title: title ?? "New meeting", interval: change.proposed },
          ]);
        } else {
          setMeetings((current) =>
            current.map((meeting) =>
              meeting.id === change.eventId
                ? { ...meeting, title: title ?? meeting.title, interval: change.proposed }
                : meeting,
            ),
          );
        }
      }}
    >
      <Calendar.Frame>
        <Calendar.Toolbar>
          <Calendar.PreviousTrigger>Previous</Calendar.PreviousTrigger>
          <Calendar.TodayTrigger>Today</Calendar.TodayTrigger>
          <Calendar.NextTrigger>Next</Calendar.NextTrigger>
          <Calendar.Title />
        </Calendar.Toolbar>
        <Calendar.Viewport>
          <Calendar.ActiveView />
        </Calendar.Viewport>
      </Calendar.Frame>
    </Calendar.Root>
  );
}

Root renders no element. Frame is the calendar's <section>, named by label, and ActiveView renders the active view's Renderer. The parts render plain elements with a data-calendar-part attribute and bring no styles, so the look is your CSS.

onEventChange receives every change to an event: a move, a resize, a create or a delete. This agenda binds no dragging, so here the changes come from an agent, and titleFrom reads the title the agent sent.

Mount it

Load a Temporal polyfill where the browser lacks one, then import the app, so no module runs before Temporal exists. The page's index.html loads this file as a module script and has the <div id="root"> it renders into:

main.tsx
import { render } from "@solidjs/web";

// Chromium and Firefox ship Temporal. Load the polyfill where it's missing, before the calendar.
if (!("Temporal" in globalThis)) await import("temporal-polyfill/global");

const { App } = await import("./app");

render(() => <App />, document.getElementById("root")!);

The calendar now shows the two weeks from Monday, October 5, 2026, with the standup on Thursday, and the toolbar's buttons move it two weeks at a time:

Live. These are the three files above, with the browser's own styles.

Read the state

The hooks read the calendar from any component inside Root. Each one that reads a value returns an accessor, so call it where you use it: view(), range().

status.tsx
import { Calendar } from "./calendar";

// Render it inside <Calendar.Root>.
export function Status() {
  const state = Calendar.useCalendarState();
  const range = Calendar.useVisibleRange();
  const view = Calendar.useCalendarSelector((current) => current.view);
  const saving = Calendar.useCalendarPendingChanges((changes) => changes.size > 0);
  const actions = Calendar.useCalendarActions();

  return (
    <p>
      {view()} from {range()?.start.toString()}, anchored on {state().anchorDate.toString()}
      {saving() ? ", saving" : ""}
      <button type="button" onClick={() => actions.navigateToday()}>
        Today
      </button>
    </p>
  );
}

Next steps

On this page