You can punch the size here if you know it upfront:

This is just a preview. This widget will now behave as if it was in a slot with those dimensions.
How can I set the size of a widget according to the size of one of its children without a Canvas Panel in sight?
This is another question altogether. Once a widget sits in a slot, it reports a desired size, the parent may or may not respect that. One way to ensure the child reports a specific size is to wrap the child (or the content of the Overlay) with a size box and punch it min / max values. After this, the parent will (try to) respect those.
In the example you show, the preview is set to Desired on Screen => one of the elements in the hierarchy requested that size (probably an image), like so:
This is nice and dandy in the preview but what happens when the slot this widget ends up it cannot accommodate it?
