How about this:
One note, adding to viewport reconstructs the widget - if you have any script there, it will be rerun and the widget laid out again. Could be irrelevant here but another way to go about it is to keep the widget in the viewport, but keep it hidden. Tab would show / hide it instead.
You can validate references by right clicking pins, like so:
This is only needed if you expect this widget to be destroyed, and the ref should also be validated when hitting Tab.