How to disable a MDBDatepicker in react ?


Topic: How to disable a MDBDatepicker in react ?

WingedImagination pro premium priority asked 2 years ago

Hi,

How to disable a MDBDatepicker in react ?


Krzysztof Wilk staff answered 2 years ago

Hi!

You can use an inputProps property to pass a readOnly one to the input. So it should look like:

<MDBDatepicker inputProps={{ readOnly: true }} />.

Keep coding!


WingedImagination pro premium priority answered 2 years ago

Hi!

Thank you for your response. Unfortunately, using your method only causes the field to be grayed out. You can still change the date via the icon. Is there any way to disable MDBDatepicker ?


Krzysztof Wilk staff answered 2 years ago

Hi!

It seems there's a problem with that, we have to check it on our side. For now, you can try using this workaround in CSS, hope it'll meet your expectations :)

.datepicker,
.datepicker-toggle-button {
  pointer-events: none;
}

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 3.0.0
  • Device: Macbook pro
  • Browser: Google Chrome
  • OS: macOS
  • Provided sample code: No
  • Provided link: No