J. Doe
J. Doe

Reputation: 73

How to display alert / popup on click?

I'm using this date picker component and I'm using the 'disablePast' prop. This means that on the calendar they're greyed out and cannot be selected. How can you make it so that you can create an alert or popup when you try and click on any of the disabled days (past dates). Thanks!

<DatePicker
          inputVariant='outlined'
          disableToolbar
          format='dd/MM/yyyy'
          margin='normal'
          id='Select-Start-Date'
          label='Select Start Date'
          value={selectedStartDate}
          onChange={handleStartDateChange}
          inputProps={{ style: { textAlign: 'center' } }
          disablePast

        />

Upvotes: 2

Views: 252

Answers (1)

Dmitrii G.
Dmitrii G.

Reputation: 899

either fork that lib to add the functionality you need or use a dirty hook like noticing what class is added to the disabled dates and adding a click listeners to the document which checks if click was in those class objects area

Upvotes: 1

Related Questions