Skip to content

[DatePicker] Add possibility to customize particular days #3794

@izziaraffaele

Description

@izziaraffaele

A callback just like shouldDisableDate() to render each day of the calendar would solve the issue and make the DatePicker much more flexible.

This callback ( ex getDayElement() ) must always return a DayButton instance and it's set internally by default. If the callback is passed by props, then the internal callback will be overwritten so that developer can return a customized instance of DayButton from the parent component.

This can also replace completely shouldDisableDate() callback as the developer can set the disable state directly on the DayButton component.

var myDayGetter = function(day){
  // do something with day
  return <DayButton disabled date={day} style={...} />
}

<DatePicker getDayElement={myDayGetter}/>

I see that you're redesigning the component here #3739 so if you like the idea we could integrate it with that...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions