Views
Switch, restrict, and control the day, week, month, and agenda views of the dash-mui-scheduler EventCalendar.
Calendar views
dms.EventCalendar ships four built-in views: day, week, month, and agenda. By default all four are available and the calendar opens on "week". A standalone calendar already lets the user switch views with its built-in view switcher — you only need a callback when you want to restrict, preset, or programmatically drive the view from elsewhere in your layout.
The two props that govern this are view (the currently active view) and views (the list of views the user is allowed to choose from).
view is a plain string — one of "day", "week", "month", "agenda". Keep defaultVisibleDate an ISO date string (here "2024-01-15") so the seeded events land on screen at load.
Available views
The four view names are fixed:
"day"— a single day, hour by hour."week"— seven day columns (the default)."month"— a month grid."agenda"— a chronological list of upcoming events.
You set the starting view with defaultView (uncontrolled) or view (controlled). defaultView defaults to "week".
Restricting views
Pass views=[...] to limit which view buttons the calendar renders. Anything omitted from the list is hidden from the switcher. Combine it with defaultView to choose which of the allowed views shows first — just make sure defaultView is one of the values in views.
# File: docs/views/views_basic.py
from dash import html, Input, Output, State, callback
import dash_mantine_components as dmc
import dash_mui_scheduler as dms
# Dates are ISO strings (wall time, no Z). The component writes the full
# `events` array back to Dash on every create / move / resize / delete.
events = [
{"id": "1", "title": "Sprint planning", "start": "2024-01-15T09:00:00", "end": "2024-01-15T10:30:00", "color": "blue"},
{"id": "2", "title": "Design review", "start": "2024-01-16T13:00:00", "end": "2024-01-16T14:00:00", "color": "purple"},
{"id": "3", "title": "1:1", "start": "2024-01-17T11:00:00", "end": "2024-01-17T11:30:00", "color": "green"},
]
ALL_VIEWS = ["day", "week", "month", "agenda"]
# `views` controls which view buttons the calendar offers. The CheckboxGroup
# below drives it live — uncheck a view and its button disappears from the
# calendar's toolbar. `view` (controlled) is kept on a value that still exists.
component = html.Div(
[
dmc.CheckboxGroup(
id="views-restrict-group",
label="View buttons to offer",
description="Toggle which views appear in the calendar's toolbar.",
value=ALL_VIEWS,
mb="md",
children=dmc.Group(
[dmc.Checkbox(label=v.capitalize(), value=v) for v in ALL_VIEWS],
mt="xs",
),
),
dms.EventCalendar(
id="views-restrict-cal",
events=events,
views=ALL_VIEWS,
view="week",
defaultVisibleDate="2024-01-15",
height=560,
),
]
)
@callback(
Output("views-restrict-cal", "views"),
Output("views-restrict-cal", "view"),
Input("views-restrict-group", "value"),
State("views-restrict-cal", "view"),
prevent_initial_call=True,
)
def restrict_views(selected, current_view):
# Keep the canonical order; always leave at least one view available.
views = [v for v in ALL_VIEWS if v in selected] or ["week"]
# If the active view was just removed, fall back to the first remaining one.
view = current_view if current_view in views else views[0]
return views, view
Controlling the active view
To drive the view from your own controls, treat view as a controlled prop: it is both an input and an output. The example below wires a dmc.SegmentedControl to the calendar's view prop. The first callback pushes the segmented control's value into the calendar; the second reads view back out — so when the user clicks the calendar's own view buttons, the segmented control follows along. Both callbacks use prevent_initial_call=True to avoid a fight on load.
# File: docs/views/controlled_view.py
from dash import html, Input, Output, callback
import dash_mantine_components as dmc
import dash_mui_scheduler as dms
events = [
{
"id": "1",
"title": "Standup",
"start": "2024-01-15T09:00:00",
"end": "2024-01-15T09:15:00",
"color": "teal",
},
{
"id": "2",
"title": "Workshop",
"start": "2024-01-16T14:00:00",
"end": "2024-01-16T16:00:00",
"color": "orange",
},
{
"id": "3",
"title": "Retro",
"start": "2024-01-18T15:00:00",
"end": "2024-01-18T16:00:00",
"color": "pink",
},
]
# `view` is controlled IN + OUT. The SegmentedControl writes it, and the
# calendar writes it back when the user clicks a built-in view button —
# the second callback keeps the SegmentedControl in sync.
component = dmc.Stack(
[
dmc.SegmentedControl(
id="views-controlled-segmented",
value="week",
data=[
{"label": "Day", "value": "day"},
{"label": "Week", "value": "week"},
{"label": "Month", "value": "month"},
{"label": "Agenda", "value": "agenda"},
],
),
dms.EventCalendar(
id="views-controlled-cal",
events=events,
view="week",
defaultVisibleDate="2024-01-15",
height=600,
),
],
gap="sm",
)
@callback(
Output("views-controlled-cal", "view"),
Input("views-controlled-segmented", "value"),
prevent_initial_call=True,
)
def set_view(value):
return value
@callback(
Output("views-controlled-segmented", "value"),
Input("views-controlled-cal", "view"),
prevent_initial_call=True,
)
def read_view(view):
return view
view has an uncontrolled twin, defaultView. Use defaultView for a fixed starting view you never read back, and view when you need two-way binding like the example above. Don't set both.
EventCalendar props
EventCalendar props
| prop | type | description | |||||
|---|---|---|---|---|---|---|---|
id | string; optional | The id used to identify this component in Dash callbacks. | |||||
areEventsDraggable | boolean; optional | Allow drag-to-reschedule. Default True. | |||||
areEventsResizable | boolean \ | a value equal to: 'start', 'end'; optional | Allow resize (bool, or restrict to "start"/"end"). Default True. | ||||
canDragEventsFromTheOutside | boolean; optional | Allow external events to be dragged in. Default False. | |||||
canDropEventsToTheOutside | boolean; optional | Allow events to be dragged out of the calendar. Default False. | |||||
className | string; optional | CSS class applied to the wrapping div. | |||||
defaultPreferences | dict; optional | Uncontrolled initial preferences (same shape as preferences). defaultPreferences is a dict with keys: - ampm (boolean; optional) - weekStartsOn (a value equal to: 0, 1, 2, 3, 4, 5, 6; optional) - showWeekends (boolean; optional) - showWeekNumber (boolean; optional) - isSidePanelOpen (boolean; optional) - showEmptyDaysInAgenda (boolean; optional) | |||||
defaultView | a value equal to: 'day', 'week', 'month', 'agenda'; optional | Uncontrolled initial view. Default "week". | |||||
defaultVisibleDate | string; optional | Uncontrolled initial visible date (ISO string). Default today. | |||||
defaultVisibleResources | dict; optional | Uncontrolled initial resource visibility map. Default {} (all visible). | |||||
displayTimezone | string; optional | Timezone used to render events: an IANA name ("America/New_York"), or "default" / "locale" / "UTC". Render-only — events keep their own data timezone. Default "default". | |||||
eventColor | a value equal to: 'red', 'pink', 'purple', 'indigo', 'blue', 'teal', 'green', 'lime', 'amber', 'orange', 'grey'; optional | The default color palette used for all events. Overridden per resource (eventColor) and per event (color). Default "teal". | |||||
eventCreation | dict; optional | Configures event creation. False disables it; True enables it with defaults; an object sets the interaction and default duration (minutes). eventCreation is a boolean \ | dict with keys: - interaction (a value equal to: 'click', 'double-click'; optional) - duration (number; optional) | ||||
eventDialogTopOffset | number; optional | On desktop, inset the event drawer this many px from the top — e.g. set it to your fixed app header's height so the drawer lines up with a sidebar instead of covering the header. Default 0. | |||||
eventDialogVariant | a value equal to: 'drawer', 'dialog'; default 'drawer' | How the event editor is presented. "drawer" (default) restyles the built-in dialog into a responsive drawer — right-anchored on desktop, an 80%-height bottom sheet on mobile (below mobileBreakpoint), with a scrollable body and pinned header/actions. "dialog" keeps the library's default floating, draggable dialog. | |||||
events | list of dicts; optional | The events to render. Each event is a dict with at least id, title, start and end (ISO strings). This is BOTH an input and an output: the calendar writes the full array back on every create / edit / move / resize / delete. events is a list of dicts with keys: - id (string \ | number; required): Unique id (string or number). - title (string; required): Event title. - start (string; required): Start date-time, ISO string. "Z" suffix = UTC instant. - end (string; required): End date-time, ISO string. "Z" suffix = UTC instant. - description (string; optional): Optional longer description (shown in the event dialog). - timezone (string; optional): IANA timezone the wall-time start/end are interpreted in. - resource (string \ | number; optional): Id of the resource this event belongs to. - rrule (string \ | dict; optional): Recurrence rule — an RFC-5545 RRULE string ("FREQ=WEEKLY;INTERVAL=2;BYDAY=TH") or an object {freq, interval, byDay, byMonthDay, byMonth, count, until}. Recurrence is a Premium feature (use EventCalendarPremium). - exDates (list of strings; optional): Exception dates (ISO strings) excluded from the recurrence. - allDay (boolean; optional): Whether the event spans the whole day. - readOnly (boolean; optional): Whether the event cannot be edited / dragged / resized. - color (a value equal to: 'red', 'pink', 'purple', 'indigo', 'blue', 'teal', 'green', 'lime', 'amber', 'orange', 'grey'; optional): Event color (overrides resource + component color). - draggable (boolean; optional): Per-event drag override. - resizable (boolean \ | a value equal to: 'start', 'end'; optional): Per-event resize override (bool or which edge). - className (string; optional): Custom CSS class for the event element. - extractedFromId (string \ | number; optional): Id of the event this one was split from. |
height | number \ | string; default 600 | Height of the wrapping container (the calendar fills it). Default 600. | ||||
lastAction | dict; optional | Convenience OUTPUT describing the most recent change to events: {type: "create"\ | "update"\ | "delete"\ | "move"\ | "resize"\ | "change", event: the affected event (or None), event_timestamp}. lastAction is a dict with keys: - type (string; optional) - event (dict; optional) - event_timestamp (number; optional) |
localeText | dict; optional | Override UI label strings (a partial map of translation keys). | |||||
mobileBreakpoint | number; default 768 | Width (px) below which the UI switches to its mobile layout. Default 768. | |||||
preferences | dict; optional | Controlled user preferences. Also an OUTPUT. {ampm, weekStartsOn (0=Sun..6=Sat), showWeekends, showWeekNumber, isSidePanelOpen, showEmptyDaysInAgenda}. preferences is a dict with keys: - ampm (boolean; optional) - weekStartsOn (a value equal to: 0, 1, 2, 3, 4, 5, 6; optional) - showWeekends (boolean; optional) - showWeekNumber (boolean; optional) - isSidePanelOpen (boolean; optional) - showEmptyDaysInAgenda (boolean; optional) | |||||
preferencesMenuConfig | dict; optional | Which items appear in the preferences menu, or False to hide the menu. preferencesMenuConfig is a a value equal to: false \ | dict with keys: - toggleWeekendVisibility (boolean; optional) - toggleWeekNumberVisibility (boolean; optional) - toggleAmpm (boolean; optional) - toggleEmptyDaysInAgenda (boolean; optional) - toggleWeekStartsOn (boolean; optional) | ||||
readOnly | boolean; optional | Global read-only mode (disables create / drag / resize / dialog). | |||||
resources | list of dicts; optional | Resources events can be assigned to (supports nested children). | |||||
responsiveSidePanel | boolean; default True | When True (default), the side panel starts open on wide screens and collapsed below mobileBreakpoint on first render — unless you pin isSidePanelOpen via preferences / defaultPreferences. | |||||
scrollToCurrentTime | boolean; default False | In the day / week views, scroll the time grid on first render (and on view change) so the current-time indicator is centered in view. Pairs with showCurrentTimeIndicator. Default False. | |||||
shouldEventRequireResource | boolean; optional | Require every event to be assigned to a resource. Default False. | |||||
showCurrentTimeIndicator | boolean; optional | Show the current-time indicator line in time views. Default True. | |||||
sx | dict; optional | MUI sx styling object applied to the calendar (object form only). | |||||
view | a value equal to: 'day', 'week', 'month', 'agenda'; optional | Controlled active view. Also an OUTPUT (updated on view change). | |||||
views | list of a value equal to: 'day', 'week', 'month', 'agenda's; optional | Which views are offered. Default ["day","week","month","agenda"]. | |||||
visibleDate | string; optional | Controlled visible date (ISO string). Drives which date range is shown. Also an OUTPUT — written back (ISO string) when the user navigates. | |||||
visibleResources | dict; optional | Controlled resource visibility map {resourceId: bool}. Also an OUTPUT. |
Source: /views
Note for AI agents: This is the static, prerendered view of an interactive Dash application served because we detected a non-JS user agent. Full prose docs:
- /views/llms.txt — LLM-friendly documentation
- /sitemap.xml
- /robots.txt