mui / mui/material-ui

[DatePicker] smaller static date picker on desktop

Open
#27,700 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: DatePicker scope: pickers type: new feature
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

I'd like the static date picker to be smaller on desktop, perhaps matching the material ui specification:

image

The specification describes a total width of 256 pixels. material-ui's implementation is 320 pixels wide. This is wide enough to be problematic for my layout.

I'd prefer smaller by default, but a well-supported way to customize sizing would also be fine with me.

Examples 🌈

https://codesandbox.io/s/relaxed-fermat-o3htk?file=/src/Demo.tsx shows both the original formatting and roughly the formatting I'd like. The latter I managed to get with <Box sx={{...}}> (quoting the relevant part below). Unfortunately, it's ridiculously fragile. Eg, I had to adapt it when upgrading from 5.0.0-alpha.26 to 5.0.0-beta.3.

      <Box
        sx={{
          "& > div": {
            minWidth: 256
          },
          "& > div > div, & > div > div > div, & .MuiCalendarPicker-root": {
            width: 256
          },
          "& .MuiTypography-caption": {
            width: DATE_SIZE,
            margin: 0
          },
          "& .PrivatePickersSlideTransition-root": {
            minHeight: DATE_SIZE * 6
          },
          '& .PrivatePickersSlideTransition-root [role="row"]': {
            margin: 0
          },
          "& .MuiPickersDay-dayWithMargin": {
            margin: 0
          },
          "& .MuiPickersDay-root": {
            width: DATE_SIZE,
            height: DATE_SIZE
          }
        }}
      >
        <StaticDatePicker ... />
      </Box>

Motivation 🔦

I'm writing a network video recorder and want a design with a static datepicker in a column. It's static rather than a pop-up because it displays useful context about what dates have video/motion/etc. But space is precious; I have a large main column of video (or tabular data or whatever) to show. So I don't want big touch-friendly targets when I'm on desktop with a mouse or trackpad available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the StaticDatePicker implementation and the linked CodeSandbox, then compare its desktop dimensions with the Material Design specification. The requested outcome is a 256-pixel-wide static picker by default or a stable, well-supported sizing customization path; verify that the result avoids the fragile selector overrides shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
design, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.