React-day-picker: Disabled DayPickerInput?

Created on 11 Jul 2018  路  5Comments  路  Source: gpbl/react-day-picker

Is there a way to disable the input on DayPickerInput? I have a scenario where I have to chose a begin and start date and sometimes the start date is fixed and should not be changed. I would like to see the option to not be able to change the input but show the calendar.

Most helpful comment

To be clear: disabled will prevent from opening the overlay, readOnly will just make the input field read-only (but the overlay will open):

https://codesandbox.io/s/7yymmyokoj

All 5 comments

Have you tried to set it to readOnly? It should work!

Not sure if I'm missing something here, I'm passing a readOnly prop set to true but nothing seems to happen to the input?

<DayPickerInput
   ...
   readOnly={true}
/>

Where am I going wrong?

@tomalexhughes:

<DayPickerInput inputProps={{ readOnly: true }} />

I'm still able to interact with the date picker if a I click on the field with readOnly: true.

__EDIT:__ I used disabled: true, which works as you would expect.

To be clear: disabled will prevent from opening the overlay, readOnly will just make the input field read-only (but the overlay will open):

https://codesandbox.io/s/7yymmyokoj

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trevordmiller picture trevordmiller  路  4Comments

wenzoto picture wenzoto  路  6Comments

kostiantyn-solianyk picture kostiantyn-solianyk  路  4Comments

leiit picture leiit  路  6Comments

magnusohlin picture magnusohlin  路  4Comments