jquense / react-big-calendar

gcal/outlook like calendar component
http://jquense.github.io/react-big-calendar/examples/index.html
MIT License
7.88k stars 2.23k forks source link

How am I able to show a button on the day cell on hovering? #1904

Open tonyabracadabra opened 3 years ago

tonyabracadabra commented 3 years ago

I am trying to use slotPropGetter but looks like that's for style only, am I able to add additional component on the slot?

What I want to achieve is to show an add button on the slot on hovering image

rikinshah23 commented 3 years ago

Were you able to figure this out?

usersina commented 1 year ago

No solution yet, but looks like these issues are somewhat related:

krumm1 commented 11 months ago

I did something like this:

added custom timeSlotWrapper

<Calendar components={{
  timeSlotWrapper: props => <CustomTimeSlot {...props} onClick={onAddEvent} />
}} />

CustomTimeSlot:

const CustomTimeSlot = ({ children, value, resource, onClick }) => {
  // displaying default time from left column
  if (resource === undefined) return children;
  // your jsx below
  return <div>
   <button onClick={() => onClick({date: value, resource})}>+</button>
  </div>
}

Added pointer-events: none to .rbc-events-container and pointer-events: auto to .rbc-event Don't forget to implement onAddEvent

Tested only in day and week view modes

Chamesss commented 2 months ago
<Calendar
   components={{
      month: {
         dateHeader: (props) => <DayCell props={props} /> //  this is how you control the header cell for each one in month view
      }
   }
/>

I hope this helps

redouand commented 1 month ago

did you have any luck, i am trying to do the same i can't figure out anything, the structure of the calendar is so bad where they have the content cell and bg cell seperated