Hello, libohan1312
To do this, you can use UUserWidget::SetDesiredSizeInViewport function:
UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="User Interface|Viewport")
void SetDesiredSizeInViewport (FVector2D Size)
Hope this helped!
Good luck!