Agenda
The Solid agenda, a chronological list of events grouped by day that renders only the days in view, from the Solid registry.
The Solid demo has it beside the week, the day, the month and the year: pick Agenda in the view switcher.
createAgendaView lists the events in the coming weeks, one group per day. Days without events are
left out. Only the days in view render, so a long range, such as weeks: 104 with thousands of
events, stays fast. The scrolling agenda is the same list
scrolling through months or years, with the anchor date on top.
Add it
Add the list-view item to your app with the shadcn CLI, as
UI source describes. It brings the theme and the shared
calendar parts:
npx shadcn@latest add @moltenship/list-viewThen register the view, and render it in Calendar.ActiveView:
import {
createCalendar,
createCanonicalEventAdapter,
type CalendarEvent,
} from "@moltenship/calendar-solid";
import type { CalendarEventColor } from "@/components/calendar/event-colors";
import { createAgendaView } from "@/components/calendar/list-view/agenda-view";
export type Event = CalendarEvent<{ readonly color: CalendarEventColor }>;
export const Calendar = createCalendar<Event>()({
eventAdapter: createCanonicalEventAdapter<{ readonly color: CalendarEventColor }>(),
views: [createAgendaView<Event>({ getEventColor: (event) => event.data.color })],
});The view is named agenda. It decides which days render with @tanstack/virtual-core, which the
item installs.
Options
Pass them to createAgendaView, or per root in viewOptions, where they override the view's own:
export function Schedule(props: { events: readonly Event[]; fetching: boolean }) {
return (
<Calendar.Root
defaultAnchorDate={Temporal.Now.plainDateISO()}
defaultTimeZone={Temporal.Now.timeZoneId()}
events={props.events}
locale="en-GB"
viewOptions={{ agenda: { loading: props.fetching, weeks: 8 } }}
weekRules={weekRules}
>
<Calendar.ActiveView />
</Calendar.Root>
);
}Prop
Type
What it shows
- Days: each day with events gets a date column that stays in view while you scroll its
events. Today is highlighted, and its date is
aria-current="date". - Times are formatted as a range with
Intl, as in "10:00 – 11:30 AM". Events that started the day before read "Until 2:00 AM"; events that run into the next day read "From 10:00 PM". - All-day events show an "All day" badge, and events longer than a day show "Day 2 of 3".
- Empty range: a short message when the weeks shown have no events, or a loading one while
loadingis set. - Clicking a date opens that day in the view named
day. Register the registry's day view, or a view of your own by that name, so the click has somewhere to go. - Changes being saved: events with a pending change, the ones
useCalendarPendingChangesreturns, getaria-busyand render at 60% opacity. - On a phone each event stacks its time above its title, and every date and event is at least 24 px tall.
- Right to left mirrors the list, the date column included, when the page or
Calendar.Framehasdir="rtl". - Reduced motion keeps the loading spinner still.
Each day has data-date, and each event is a <button> with data-event-id.
Anatomy
AgendaView renders a list with one group per day. The view builds these parts itself, so they're
not parts you compose: to change one, edit its file under components/calendar/list-view.
AgendaView agenda-view.tsx
├── AgendaList agenda-list.tsx, scrolls the days in view
│ └── Day group agenda-day.tsx, data-date, one per day
│ ├── Day group header weekday and date, sticky
│ └── AgendaItem agenda-item.tsx, one per event
└── Empty state agenda-states.tsx, EmptyAgenda: in place of the listThe .tsx files are Solid components. What they render comes from plain TypeScript beside them:
| File | Holds |
|---|---|
agenda.styles.ts | Every class the parts set, so a restyle is one file |
agenda-labels.ts | The time ranges, "All day", "Day 2 of 3" and the empty-state words |
agenda-rows.ts | The rows the list renders, one per day |
agenda-virtualizer.ts | Which days render and where, on @tanstack/virtual-core |
use-agenda-virtualizer.ts | Binds that to the list element and Solid's reactivity |
AgendaItem renders the shared EventChip from components/calendar/event-chip.tsx, whose name,
color and pending state the other views' events share.
Keyboard
| Focus | Key | Effect |
|---|---|---|
| An event | ↑ ↓ | Previous or next event |
| An event | Page Up, Page Down | First event of the previous or next day |
| An event | Home, End | First or last event |
| An event | Enter | Open it, as a click does |
| An event | Shift+Enter | Open its date in the day view |
| A range without events | ↑ or Page Up, ↓ or Page Down | The previous or next range |
The list is one tab stop. Moving past the first or last event shows the previous or next weeks. The
list scrolls to keep the focused event in view, and the focused day stays rendered while focus is
in the list. The agenda doesn't move or create events from the keyboard, since it has no days or
times to move them to. The keys are the ones view-keys.ts maps, the same in every view.
Screen readers
The list is an <ol> named by its weeks. Only the days in view render, so each day's <li>
carries aria-posinset and aria-setsize, counting every day listed: "list item, 5 of 41". The
list is aria-busy while loading is set. A range without events is a focusable group named by
its message: "No events. Nothing is scheduled for October 5 – 18.", or "Loading events" while
loading is set.