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:
defaultPreferences— the initial, uncontrolled preference values applied on load.preferences— the controlled IN+OUT version. It seeds the UI and reports the
current values back to Dash whenever the user changes a setting.
preferencesMenuConfig— which entries appear in the preferences menu (or whether the
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.
| Key | Type | Meaning |
|---|---|---|
ampm | bool | 12-hour (True) vs 24-hour (False) clock |
weekStartsOn | int 0–6 | First day of the week (0 = Sunday … 1 = Monday) |
showWeekends | bool | Show Saturday/Sunday columns |
showWeekNumber | bool | Show the ISO week number |
isSidePanelOpen | bool | Whether the date/resource side panel starts open |
showEmptyDaysInAgenda | bool | Keep 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:
- Pass
Falseto hide the entire preferences menu (useful for a locked-down, read-only
display).
- Pass a dict to show or hide individual entries. Each key is a boolean:
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
| 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: /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:
- /preferences/llms.txt — LLM-friendly documentation
- /sitemap.xml
- /robots.txt