in header
UPROPERTY()
UButton* Button;
in cpp cdo
Button = CreateDefaultSubobject<UButton>(TEXT("Button"));
Button->OnClicked.AddDynamic(this, &UMyWidget::Click);
Where UMyWidget::Click would be the click function inside of the class UMyWidget
You can ofc bind to another class if needed. I’m guessing it would be a self contained class probably derived from UUserWidget.