Published a blog post
You could be forgiven if you thought that the overall div container that the Power Apps Component Framework gives you would constrain your control to the outer boundary. You might also think that you'd automatically get the runtime height and width of your control when you asked for it.

The bad news is that neither of those are true without a little extra work in your control code. The good news is both of them are fixable in just a line of code or two.

https://98.codes/keep-those-pcf-components-inside-the-box/