Control the EventCalendar's default display preferences and the user-facing preferences menu in dash-mui-scheduler.

Preferences

Control the EventCalendar's default display preferences and the user-facing preferences menu in dash-mui-scheduler.


Preferences

Every calendar exposes a small set of user preferences — am/pm clock, which day the week starts on, whether weekends and week numbers are shown, and so on. These are surfaced through a built-in preferences menu (the gear button in the calendar header) so users can tweak the view themselves.

In dash_mui_scheduler you control three related things:

current values back to Dash whenever the user changes a setting.

menu shows at all).

All of these work the same way on EventCalendar, EventCalendarPremium, and (a smaller subset) on EventTimeline.

Default preferences

defaultPreferences is a dict. Set only the keys you care about — anything omitted falls back to the component's own defaults.

KeyTypeMeaning
ampmbool12-hour (True) vs 24-hour (False) clock
weekStartsOnint 0–6First day of the week (0 = Sunday … 1 = Monday)
showWeekendsboolShow Saturday/Sunday columns
showWeekNumberboolShow the ISO week number
isSidePanelOpenboolWhether the date/resource side panel starts open
showEmptyDaysInAgendaboolKeep empty days visible in the agenda view

Use defaultPreferences when you just want a starting configuration and don't need to read changes back. Use preferences when you want the current values in a callback — it is both an input and an output, so the component writes the full preferences dict back on every toggle.

Reading preferences

Because preferences is IN+OUT, you can attach a callback whose only job is to read the current values. The example below seeds the calendar with a Monday week start, 24-hour clock, and visible week numbers via defaultPreferences, then echoes the live preferences dict each time the user changes something in the menu.

# File: docs/preferences/preferences_default.py

import json

import dash_mantine_components as dmc
from dash import Input, Output, State, callback, html

import dash_mui_scheduler as dms

events = [
    {"id": "1", "title": "Design review", "start": "2024-01-15T09:00:00", "end": "2024-01-15T10:30:00", "color": "blue"},
    {"id": "2", "title": "Saturday standup", "start": "2024-01-20T11:00:00", "end": "2024-01-20T12:00:00", "color": "green"},
]

# `preferences` is controlled IN + OUT. We seed it, drive it from the switches
# below, and read it back in a callback. (The calendar also writes it back when
# the user toggles a setting in its own gear menu.)
INITIAL = {
    "ampm": False,
    "weekStartsOn": 1,
    "showWeekends": True,
    "showWeekNumber": True,
    "isSidePanelOpen": True,
    "showEmptyDaysInAgenda": True,
}

component = html.Div(
    [
        dmc.Group(
            [
                dmc.Switch(id="pref-ampm", label="12-hour clock", checked=INITIAL["ampm"]),
                dmc.Switch(id="pref-weekends", label="Show weekends", checked=INITIAL["showWeekends"]),
                dmc.Switch(id="pref-weeknum", label="Week numbers", checked=INITIAL["showWeekNumber"]),
            ],
            mb="md",
        ),
        dms.EventCalendar(
            id="preferences-default-cal",
            height=560,
            events=events,
            defaultView="week",
            defaultVisibleDate="2024-01-15",
            preferences=INITIAL,
        ),
        dmc.Code(id="preferences-default-readout", block=True, mt="sm"),
    ]
)


@callback(
    Output("preferences-default-cal", "preferences"),
    Input("pref-ampm", "checked"),
    Input("pref-weekends", "checked"),
    Input("pref-weeknum", "checked"),
    State("preferences-default-cal", "preferences"),
    prevent_initial_call=True,
)
def set_preferences(ampm, weekends, week_number, current):
    prefs = dict(current or INITIAL)
    prefs.update({"ampm": ampm, "showWeekends": weekends, "showWeekNumber": week_number})
    return prefs


@callback(
    Output("preferences-default-readout", "children"),
    Input("preferences-default-cal", "preferences"),
)
def show_preferences(preferences):
    # `preferences` flows back out whenever it changes — from the switches above
    # or from the calendar's own gear menu.
    return json.dumps(preferences or INITIAL, indent=2, sort_keys=True)

The readout updates as you toggle items in the calendar's preferences menu — no extra plumbing required, since the component pushes the new dict back through Dash's normal setProps round-trip.

The preferences menu

preferencesMenuConfig controls the menu itself:

display).

toggleWeekendVisibility, toggleWeekNumberVisibility, toggleAmpm, toggleEmptyDaysInAgenda, and toggleWeekStartsOn.

The first calendar below keeps the weekend, week-number, and am/pm toggles but removes the "empty days in agenda" and "week starts on" entries. The second passes preferencesMenuConfig=False, so its menu button disappears entirely.

# File: docs/preferences/preferences_menu.py

import dash_mantine_components as dmc
from dash import html

import dash_mui_scheduler as dms

events = [
    {"id": "1", "title": "Sprint planning", "start": "2024-01-15T13:00:00", "end": "2024-01-15T14:00:00", "color": "indigo"},
    {"id": "2", "title": "Retro", "start": "2024-01-18T15:00:00", "end": "2024-01-18T16:00:00", "color": "amber"},
]

# preferencesMenuConfig prunes the gear/preferences menu.
# Pass a dict to toggle individual items, or False to hide the whole menu.
component = dmc.Stack(
    [
        dmc.Text("Custom menu — only weekends, week number, and AM/PM toggles", fw=600, size="sm"),
        dms.EventCalendar(
            id="preferences-menu-cal",
            height=480,
            events=events,
            defaultView="week",
            defaultVisibleDate="2024-01-15",
            preferencesMenuConfig={
                "toggleWeekendVisibility": True,
                "toggleWeekNumberVisibility": True,
                "toggleAmpm": True,
                "toggleEmptyDaysInAgenda": False,
                "toggleWeekStartsOn": False,
            },
        ),
        dmc.Text("Menu hidden — preferencesMenuConfig=False (no gear button)", fw=600, size="sm", mt="md"),
        dms.EventCalendar(
            id="preferences-menu-hidden-cal",
            height=480,
            events=events,
            defaultView="week",
            defaultVisibleDate="2024-01-15",
            preferencesMenuConfig=False,
        ),
    ],
    gap="xs",
)

preferencesMenuConfig only decides which controls are available to the user. It does not change the actual preference values — set those with defaultPreferences / preferences. Hiding a toggle simply means the user can't change that setting from the UI; you can still set it programmatically.

Component reference

EventCalendar props

proptypedescription
idstring; optionalThe id used to identify this component in Dash callbacks.
areEventsDraggableboolean; optionalAllow drag-to-reschedule. Default True.
areEventsResizableboolean \a value equal to: 'start', 'end'; optionalAllow resize (bool, or restrict to "start"/"end"). Default True.
canDragEventsFromTheOutsideboolean; optionalAllow external events to be dragged in. Default False.
canDropEventsToTheOutsideboolean; optionalAllow events to be dragged out of the calendar. Default False.
classNamestring; optionalCSS class applied to the wrapping div.
defaultPreferencesdict; optionalUncontrolled 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)
defaultViewa value equal to: 'day', 'week', 'month', 'agenda'; optionalUncontrolled initial view. Default "week".
defaultVisibleDatestring; optionalUncontrolled initial visible date (ISO string). Default today.
defaultVisibleResourcesdict; optionalUncontrolled initial resource visibility map. Default {} (all visible).
displayTimezonestring; optionalTimezone used to render events: an IANA name ("America/New_York"), or "default" / "locale" / "UTC". Render-only — events keep their own data timezone. Default "default".
eventColora value equal to: 'red', 'pink', 'purple', 'indigo', 'blue', 'teal', 'green', 'lime', 'amber', 'orange', 'grey'; optionalThe default color palette used for all events. Overridden per resource (eventColor) and per event (color). Default "teal".
eventCreationdict; optionalConfigures 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)
eventDialogTopOffsetnumber; optionalOn 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.
eventDialogVarianta 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.
eventslist of dicts; optionalThe 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.
heightnumber \string; default 600Height of the wrapping container (the calendar fills it). Default 600.
lastActiondict; optionalConvenience 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)
localeTextdict; optionalOverride UI label strings (a partial map of translation keys).
mobileBreakpointnumber; default 768Width (px) below which the UI switches to its mobile layout. Default 768.
preferencesdict; optionalControlled 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)
preferencesMenuConfigdict; optionalWhich 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)
readOnlyboolean; optionalGlobal read-only mode (disables create / drag / resize / dialog).
resourceslist of dicts; optionalResources events can be assigned to (supports nested children).
responsiveSidePanelboolean; default TrueWhen True (default), the side panel starts open on wide screens and collapsed below mobileBreakpoint on first render — unless you pin isSidePanelOpen via preferences / defaultPreferences.
scrollToCurrentTimeboolean; default FalseIn 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.
shouldEventRequireResourceboolean; optionalRequire every event to be assigned to a resource. Default False.
showCurrentTimeIndicatorboolean; optionalShow the current-time indicator line in time views. Default True.
sxdict; optionalMUI sx styling object applied to the calendar (object form only).
viewa value equal to: 'day', 'week', 'month', 'agenda'; optionalControlled active view. Also an OUTPUT (updated on view change).
viewslist of a value equal to: 'day', 'week', 'month', 'agenda's; optionalWhich views are offered. Default ["day","week","month","agenda"].
visibleDatestring; optionalControlled visible date (ISO string). Drives which date range is shown. Also an OUTPUT — written back (ISO string) when the user navigates.
visibleResourcesdict; optionalControlled resource visibility map {resourceId: bool}. Also an OUTPUT.

Source: /preferences

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: