Event calendar preview

Event calendar

A day, week and month calendar for real schedules: overlapping events sit side by side, drag on empty space to create, drag an event to move it across days, drag its bottom edge to resize, an all-day lane, a live now-line and a details popover. Event colours come from the chart series, so they follow the accent and dark mode.

  • Group
    Calendars
  • Origin
    Adapted · Kargul Calender Design · source
  • License
    MIT
  • Added
    Oct 27
npx shadcn@latest add @deank/event-calendar

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { EventCalendar } from "@/registry/blocks/event-calendar/event-calendar";

<EventCalendar events={[/* … */]} />

Props

PropTypeDefaultDescription
eventsCalendarEvent[]
onEventsChange?(events: CalendarEvent[]) => voidCalled with the whole new list after a move, resize, delete or default create. Leave out for a read-only calendar
onCreate?(draft: EventDraft) => voidCalled when I drag out or click an empty slot. Return nothing to handle it yourself (open a dialog); without it a "New event" is added
onEventOpen?(event: CalendarEvent, anchor: HTMLElement) => voidCalled when an event is opened. Replaces the built-in popover
view?CalendarView
defaultView?CalendarView"week"
onViewChange?(view: CalendarView) => void
date?stringAny day in the visible range
defaultDate?string
onDateChange?(date: string) => void
today?stringDefaults to the real today; pin it for screenshots and tests
now?numberMinutes from midnight for the now-line. Defaults to the clock (updates every minute); pass -1 to hide it
weekStartsOn?0 | 11
timeFormat?"24h" | "12h""24h"
scrollToHour?number7Hour shown at the top edge when the time grid opens
hourHeight?number64Pixels per hour
snapMinutes?number15Minutes that drags snap to
views?CalendarView[]["day", "week", "month"]Which views the switcher offers
hideHeader?booleanHide the header (title, today, arrows, view switcher) to embed the grid on its own
actions?ReactNodeExtra controls on the right of the header, e.g. a "New event" button
className?string
style?CSSProperties
"aria-label"?string"Calendar"

When to use

Showing and editing a schedule inside an app: bookings, shifts, time off, meetings, content calendars. Week view by default, day and month one click away. Give it `events` and `onEventsChange` and it handles creating, moving, resizing and deleting; pass `onCreate` or `onEventOpen` to use my own dialog instead.

When not to use

Picking one date in a form (use date-picker); a decorative calendar in a feature card (use empty-calendar); resource timelines or Gantt charts with many rows; recurring-event rules or time zones, which it does not model (expand them into plain events first).

Related

Date picker · Empty calendar · Segmented control · Dialog · Sheet / drawer