I'm using the OverlayTrigger component to get hover behavior for tooltips, and therefore not using the Overlay component directly. The Overlay component has a container property that I'd like to use to remedy the tooltip getting cut off by its natural container element.
I've attempted to pass a popperConfig object, but that's not working. I've also tried adding a container attribute to the OverlayTrigger component.
<Container fluid className='flex-fill' ref={rowContainer}>
...
<OverlayTrigger delay={{show: 500}} overlay={renderUserTooltip}
popperConfig={{container: rowContainer}}>
<FaUser/>
</OverlayTrigger>
How can I set the container for the Overlay when the Overlay component isn't directly used?
React bootstrap doesn't have a
containerprop or something similar (I mean it has atargetprop but as this part of the docs suggests, for theOverlayTriggerthe type is null, so it doesn't accept values and I don't think you can trick it to accept (and I don't think it would be wise to try).But a pretty nice example, that shows some sort of a workaround in my opinion, can also be find in the docs, under customizing-trigger-behavior.
Starting from that example, if you need your trigger to be totally separated from the container an option is to just wrap everything in a big container that receives
({ ref, ...triggerHandler })and all is left is to give yourcontainerthe ref, and the trigger to yourFaUsercomponent. So something like:I also created a sandbox with a minimal reproducible example.