Scrolling views
Week, day, month and agenda views that scroll without end, from the Solid registry.
The week and day, month and agenda views move a page at a time. Their scrolling versions follow your finger, as Apple's Calendar does on iPad. The week and day views swipe sideways, so a week comes to rest on the next week and a day on the next day. The month swipes up and down a month at a time, and the agenda scrolls one list of days through months or years, comes to rest on any day, and jumps to a date at once. They're separate views, so the paged ones keep working as they are, and you can register both.
The Solid demo has them all: turn on "Scroll days, weeks, months and agenda" in its settings.
Add them
Add the items to your app with the shadcn CLI, as
UI source describes. Each brings the view it builds on,
time-grid-view, month-view or list-view, with the theme and the shared calendar parts:
npx shadcn@latest add @moltenship/scrolling-time-grid-view @moltenship/scrolling-month-view @moltenship/scrolling-list-viewThen register the views:
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 {
createScrollingDayView,
createScrollingThreeDayView,
createScrollingWeekView,
} from "@/components/calendar/scrolling-time-grid-view/scrolling-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: [
createScrollingWeekView<Event>({ dayView: "scrolling-day", getEventColor }),
createScrollingThreeDayView<Event>({ dayView: "scrolling-day", getEventColor }),
createScrollingDayView<Event>({ getEventColor }),
],
});The hours scroll inside the space they're given, so give Calendar.Viewport a height:
export default function ScrollingWeekPage() {
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="scrolling-week"
events={events()}
locale="en-US"
onEventChange={save}
weekRules={{ firstDay: 1, minimalDays: 4, weekend: [6, 7] }}
>
{/* The days swipe sideways and the hours scroll inside the viewport, under the header. */}
<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>
);
}The views are named scrolling-week, scrolling-3-day, scrolling-day, scrolling-month and
scrolling-agenda, and take the same options as their paged versions. dayView names the view a
date opens; it defaults to "day" in the month and agenda. For another number of days, define a
view with scrollingTimeGridStrategy({ count, kind: "days" }) and ScrollingTimeGridView, as
createScrollingThreeDayView does; it swipes that many days at a time.
How they move
| View | Shows | A swipe moves | Previous and Next | Today |
|---|---|---|---|---|
scrolling-week | The anchor's week, from weekRules | A week | A week | Today's week |
scrolling-3-day | Three days from the anchor date | Three days | Three days | Today in the first column |
scrolling-day | The anchor date | A day | A day | Today |
scrolling-month | Six weeks from the week of the 1st, or up to twelve with createScrollingMonthView(options, weeks) | A month | A month | Today's month |
scrolling-agenda | weeks from the anchor date, four by default | Free, any day | weeks | Today on top |
The anchor date is the scroll position. When a scroll comes to rest, the view sets anchorDate to
what it shows, so Calendar.Title, onAnchorDateChange, and a URL that stores the date follow the
scroll. During a long swipe the anchor follows every half page, so the next weeks load before they
scroll into view. With a controlled anchorDate, the view stays where it was scrolled until your
state takes the latest date onAnchorDateChange sent, even a few flushes later; any other
anchorDate moves the view to it. If you defer the update, commit the latest date rather than each
one in turn.
The week and day
A swipe sideways follows your finger and comes to rest on the next page, or back on this one if it went less than halfway; a fling moves one page. A swipe up or down scrolls the hours instead: the days and the hours scroll in two elements, so a swipe moves one of them, whichever way it starts. The header, the all-day row and the hour gutter stay in place while the days scroll under them, and all-day bars keep their titles on screen while their start is scrolled past. The hours open on the current time, or on 08:00 when no rendered day shows it.
When the anchor changes any other way, from Today, Next, or your own setAnchorDate, the days
scroll there: smoothly over a page or two, and at once from further away, from the keyboard, or
when the system asks for reduced motion.
The month
The month shows the anchor's month as the paged month does: six weeks from the one that holds its first day, which every month fits, with the days of other months dimmed. A swipe follows your finger and comes to rest on the next month with its first week on top, four or five weeks on, or back on this one if it went less than halfway; a fling moves one month.
The example registers the month as the week is registered above:
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 { createScrollingMonthView } from "@/components/calendar/scrolling-month-view/scrolling-month-view";
export type Event = CalendarEvent<{ readonly color: CalendarEventColor }>;
export const Calendar = createCalendar<Event>()({
eventAdapter: createCanonicalEventAdapter<{ readonly color: CalendarEventColor }>(),
views: [createScrollingMonthView<Event>({ getEventColor: (event) => event.data.color })],
});When the anchor changes any other way, from Today, Next, or your own setAnchorDate, the month
scrolls there: smoothly over a month or two, and at once from further away, from the keyboard, or
when the system asks for reduced motion.
The agenda
- The anchor date is the day on top. The range starts at the anchor date rather than its week, since the list comes to rest on any day.
- Today, Previous, Next, and any other anchor date jump the list to put that date on top, or the next day with events, at once, rather than gliding there as the month does. The list holds that date on top while its events load, until you scroll.
- Only the days in view render. Each is measured once it renders, as its events wrap, and days that load above or below the ones on screen don't move them.
- The end of the list follows the last loaded day. It's as tall as the view, so any day can
scroll to the top, and says "Loading events…" while
loadingis set, or that nothing more is scheduled. Scrolling on past either end of the loaded days moves a page that way, once per gesture, so the list crosses weeks without events. Weeks shown without events get the empty state, at the end of the list or among the days after them.
Loading events as you scroll
Each scrolling view renders a page of weeks on either side of what it shows, with their events, so
a swipe never reveals an empty page. Its strategy reports those dates as its load range, and
onVisibleRangeChange on Root hands them to you: after the first render, and whenever the view,
its dates, or the time zone change, but not when only events do.
Fetch events for loadRange and pass them in events. Set the agenda's loading while some are on
their way:
/**
* Fetches events for the dates the agenda lists, each date once, as it scrolls, and says so while
* some are still on their way.
*/
export default function ScrollingAgendaPage() {
const [loaded, setLoaded] = createSignal<ReadonlyMap<string, Event>>(new Map());
const [fetching, setFetching] = createSignal(0);
const requested = new Set<string>();
const load = ({ loadRange }: CalendarVisibleRange) => {
const missing = [...iteratePlainDates(loadRange)].filter(
(date) => !requested.has(date.toString()),
);
if (missing.length === 0) return;
for (const date of missing) requested.add(date.toString());
setFetching((count) => count + 1);
void loadEvents(missing[0]!, missing.at(-1)!.add({ days: 1 }))
.then((arrived) =>
setLoaded((current) => new Map([...current, ...arrived.map((e) => [e.id, e] as const)])),
)
.finally(() => setFetching((count) => count - 1));
};
return (
<Calendar.Root
defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
defaultTimeZone={timeZone}
events={[...loaded().values()]}
locale="en-US"
onVisibleRangeChange={load}
viewOptions={{ "scrolling-agenda": { loading: fetching() > 0 } }}
weekRules={{ firstDay: 7, minimalDays: 1, weekend: [6, 7] }}
>
<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>
);
}| Field | Contents |
|---|---|
view | The active view's name |
range | The visible dates |
instantRange | range as instants in the calendar's time zone |
loadRange | The dates to have events for: range and a page either side |
loadInstantRange | loadRange as instants, ready to send to an API |
Paged views report too: their loadRange is the visible range. Time never fetches or keeps
events itself; keep what you've loaded in your own state.
Keyboard
The keys work as in the week and day, the month and the agenda, over the dates on screen. In the week and day views, moving past the last visible day, or pressing Page Down, scrolls a whole page; in the month, to the next month. In the agenda, keys that page past the range move the calendar on. Days and weeks rendered around the visible ones are hidden from screen readers, so the grid reads as one week, one day, or six weeks. Focus on an all-day bar stays on it as the day it was focused on scrolls away.
Dragging
Drag, resize, and create work as in the paged views. Dragging toward an edge keeps scrolling into
the days or weeks beyond, rendering them as it goes: the week and day views sideways, and the hours
up and down. The views stop snapping while a gesture is under way and come to rest on the nearest
page when you let go. The dragPreview option picks snapped or free
drags here too.
How it's built
The views put their scrolling in plain TypeScript that needs an element and no framework, and the
.tsx files bind it to Solid:
| File | Holds |
|---|---|
scrolling-axis-controller.ts | The week, day and month's axis: days or weeks on a canvas thousands of items long, and where a scroll comes to rest |
scrolling-axis.tsx | useScrollingAxis, the axis in a Solid component, and the snap points |
scrolling-time-grid.ts | The week and day's days on the axis, where each page starts, and where focus on a bar goes |
time-grid-scroll.ts | The sticky header, the header and all-day row following the days, and where the hours open |
scrolling-time-grid-scroll.ts | Those in a Solid component |
scrolling-month.ts | The month's weeks on the axis, where each month starts, and how many event lanes fit |
agenda-scroll.ts | The agenda's scroll position and anchor date, which follow each other |
use-agenda-scroll.ts | The agenda's scrolling in a Solid component, on the agenda's virtualizer |
The views render only the days or weeks near their load range. The header and the all-day row follow
the days by a transform that a scroll timeline drives, where the browser has one, so they never lag
behind a swipe. The gutter's secondary time zones
follow the first visible day on which neither zone changes its clocks. Scroll positions are never
signals: the views render again only when the anchor moves. In right-to-left layouts, pass
direction="rtl" to Root, which the week and day views need to scroll their days from the right.
The month and agenda follow dir="rtl" on the page or on Calendar.Frame too.