EventList block renders a grid of event cards from the Sanity event document type. Events are fetched once per build by getAllEvents() and filtered by resolveBlockEvents() before the block receives them.
Props
Optional section heading rendered as
<h2>.Controls which events are shown. Defaults to
upcoming. Filtering logic runs in resolveBlockEvents() in sanity.ts.| Value | Behavior |
|---|---|
upcoming | Events where status == "upcoming" or date >= now (sorted ascending) |
past | Events where status == "past" or date < now (sorted descending) |
all | All events sorted by date ascending |
Maximum number of events to display. Defaults to
10.Pre-filtered array of event objects injected by
BlockRenderer via resolveBlockEvents(). Each event includes _id, title, slug, date, endDate, location, description, eventType, status, isAllDay, and category.Usage in Sanity Studio
- Add an Event List block to a page.
- Set an optional Heading.
- Choose a Filter:
upcoming,past, orall. - Set a Limit to cap the number of cards shown.
The
status field on an event takes priority over date comparison. If an event’s date has passed but status is still upcoming, it remains in the upcoming list. Set status: past manually when the event is over.Layout
Events render in a 3-column responsive grid (md:grid-cols-2 lg:grid-cols-3). Each card is rendered by EventCard.astro.