Skip to content

[docs] Fix date range calendar demo after MUI X v9 update#48262

Merged
LukasTy merged 8 commits intomui:masterfrom
LukasTy:claude/vigilant-goldwasser
Apr 13, 2026
Merged

[docs] Fix date range calendar demo after MUI X v9 update#48262
LukasTy merged 8 commits intomui:masterfrom
LukasTy:claude/vigilant-goldwasser

Conversation

@LukasTy
Copy link
Copy Markdown
Member

@LukasTy LukasTy commented Apr 10, 2026

Regressed after #48231

Also fixes selected date range regression caused by #40823. (dayjs dates are immutable)

Changes

Updates CSS selectors and styling approach for the date range picker demos to align with MUI X v9's single-element DateRangePickerDay architecture:

  • Replaced .MuiPickerDay-root and .MuiDateRangePickerDay-root sizing with CSS custom properties (--PickerDay-size, --PickerDay-horizontalMargin)
  • Updated .MuiDateRangePickerDay-day.Mui-selected.MuiDateRangePickerDay-selected (.day slot removed in v9)
  • Changed .MuiDateRangePickerDay-day:not(.Mui-selected) with borderColor.MuiDateRangePickerDay-today with outlineColor (v9 uses outline for today indicator)
  • Replaced .MuiTypography-caption.MuiDayCalendar-weekDayLabel for day-of-week header sizing
  • Added .MuiDayCalendar-root minWidth override (v9 defaults to 312px)
  • Removed redundant lineHeight: 0 and margin: 0 overrides on day elements
  • Fixed dayjs immutability bug — .date() and .add() return values were discarded, collapsing the default range to a single date

Files updated:

  • docs/src/components/productX/XDateRangeDemo.tsx
  • docs/src/components/productX/XHero.tsx
v7 v9
before after

Final result

Screenshot 2026-04-13 at 09 32 14

MUI X v9 replaced the multi-element DateRangePickerDay with a single
ButtonBase, removing .MuiDateRangePickerDay-day and .MuiPickerDay-root
classes. Update selectors to use v9 CSS variables and class names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 10, 2026

Netlify deploy preview

https://deploy-preview-48262--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against dbde99b

@LukasTy LukasTy changed the title Fix date range picker demo CSS selectors for MUI X v9 [docs] Fix date range picker demo CSS selectors for MUI X v9 Apr 10, 2026
@LukasTy LukasTy changed the title [docs] Fix date range picker demo CSS selectors for MUI X v9 [docs] Fix date range calendar demo after MUI X v9 update Apr 10, 2026
@LukasTy LukasTy added docs Improvements or additions to the documentation. type: regression A bug, but worse, it used to behave as expected. labels Apr 10, 2026
LukasTy and others added 3 commits April 10, 2026 18:05
- Increase --PickerDay-size to 32px (accounts for v8 wrapper padding)
- Replace .MuiTypography-subtitle1 with .MuiPickersCalendarHeader-labelContainer
  (v9 uses body1, not subtitle1)
- Replace .MuiTypography-caption with .MuiDayCalendar-weekDayLabel
  and align width with day size
- Override .MuiDayCalendar-root minWidth (v9 defaults to 312px)
- Remove redundant lineHeight and margin overrides

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PickersRangeCalendarHeader uses PickersArrowSwitcher which renders
a Typography variant="subtitle1" for the month label — the original
selector was correct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dayjs is immutable — .date() and .add() return new instances.
The old code discarded the return values, so both startDate and
endDate resolved to today, collapsing the range to a single date.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LukasTy LukasTy marked this pull request as ready for review April 13, 2026 06:32
LukasTy and others added 4 commits April 13, 2026 14:53
Add a regression test fixture for StaticDateRangePicker to catch
styling regressions after MUI X major upgrades. Uses pinned dates
for deterministic screenshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Include the existing XDateRangeDemo from docs/src in the regression
test import glob instead of creating a separate fixture, avoiding
code duplication. Add required MUI X dependencies to the test workspace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The docs demo import broke in CI. Use a standalone fixture with
pinned dates instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
A standalone fixture doesn't add enough value. Revert the test
workspace dependency additions as well.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LukasTy LukasTy enabled auto-merge (squash) April 13, 2026 14:12
@LukasTy LukasTy merged commit 994d369 into mui:master Apr 13, 2026
19 checks passed
@LukasTy LukasTy deleted the claude/vigilant-goldwasser branch April 13, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants