2

There is no documentation for adding a eventWrapper and I've seen a few comments saying it's not meant to be overwritten. Should we be using this or trying to create custom eventWrapper component to override this exsisting one?

For me I don't want the .rbc-event-label also want to dynamically in JS change the styling. Or should I be just changing things in the CSS?

Dryden Williams
  • 1,175
  • 14
  • 22

1 Answers1

2

You can dynamically apply additional classes and styling to your events by using the eventPropGetter property. This property takes a function that should return an object of class names and styles to be applied to an event (automatically added to the eventWrapper).

const eventRenderProps = (event, start, end, isSelected) => {
  let result = {};
  // Code to conditionally add 'className' or 'style' to the result
  return result; // {className?: String, style?: Object}
}

//
<MyCalendar eventPropGetter={eventRenderProps} />

It's important to note that this method is called on every displayed event, and will get called again on each as an event is selected or changed/updated. Also important to note that className is to be a String, and not an object, so if you require several classes you will need a space delimited list of class names.

Steve -Cutter- Blades
  • 5,057
  • 2
  • 26
  • 40