UE4's built-in blueprint function 'CreateWidget' only allows you to specify UUserWidgets, so to add something basic like a button, border or text at runtime, you have to create a custom UUserWidget to wrap it - very inefficient. Luckily, there's a ConstructWidget() function in C++ that can easily be exposed to blueprints.
Make sure you've got a BP/C++ project, then create a blueprint function library C++ class.
Add this to the .h file:
It works the same as CreateWidget, in that you'll need to add it to something after creation, in the same UUserWidget that it was created in (InWidget). So you'll normally use it like this: