How to change the SIZE of a progress bar at runtime, not the percentage that it is filled.

Before the UI can be displayed, UI design work must be done.
The same is true if you create a class in C++ that inherits from the UserWidget class, and some people use a means called Slate, but here we will assume the UMG designer functionality.
First, add Blueprintable, BlueprintType to the UCLASS specifier to allow blueprint inheritance

UCLASS(Blueprintable, BlueprintType)
class _API UStaminaWidget : public UUserWidget

Next, create a Widget with UStaminaWidget as its parent by creating a new Blueprint in Content Browser.
Then, as shown in the previous replies, resolve the errors and design the UI.
When you try to display it, you need an instance, the class is on the BP side, so from C++, you can figure out the actual class with TSubClassOf (then set it on the BP side).
For a simple example, if you want to use it in a character’s WidgetComponent, you can pass it in with SetWidget or SetWidgetClass on the BP side.