Skip to content

Adding different class names to disabled days in Matcher array #2490

Answered by gpbl
PrimozRome asked this question in Support
Discussion options

You must be logged in to vote

@PrimozRome than the modifiers prop is what you are looking for:

<DayPicker
  mode="range"
  numberOfMonths={2}
  startMonth={new Date()}
  disabled={disabled}
  modifiers={{
    past: { before: new Date() },
    future: { after: new Date() }
  }}
  modifiersClassNames={{
    past: 'my_past_classname',
    future: 'my_future_classname'
  }}
/>

Then in your CSS:

.rdp-disabled.my_past_classname {
   /* add extra style for disabled+past days cells */
}
.rdp-disabled.my_past_classname .rdp-day_button {
   /* style the button in the cell */
}

.rdp-disabled.my_future_classname {
   /* add extra style for disabled future days */
}
/* etc */

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@PrimozRome
Comment options

@gpbl
Comment options

Answer selected by gpbl
@PrimozRome
Comment options

@PrimozRome
Comment options

@PrimozRome
Comment options

@gpbl
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants