Home > Software engineering >  How to disable views button in StaticDatePicker in React MUI v5.2.2?
How to disable views button in StaticDatePicker in React MUI v5.2.2?

Time:12-10

How to disable views button in StaticDatePicker in React MUI v5?

enter image description here

The problem is that we have disabled some days and they are honored on picker view. But if you click the pencil icon it component is as shown below

enter image description here

And in this mode the user can select any date which breaks our app.

How do we disable views button? If we can't, then how do we make sure user can cannot select any date?

CodePudding user response:

Add below CSS in your code. This is just quickfix for normal users. pro people/hackers can still change this prperty from their browser and access the button.

   .PrivateDatePickerToolbar-penIcon {
      visibility: hidden
    }

Live Demo

Edit StaticDatePickerLandscape Material Demo (forked)

  • Related