How to extend UUserWidget in C++?

I want to spawn a widget pawn and change its text programmatically. However, there’s no document I could find about how to extend UUserWidget and set it as a UWidgetComponent. Can anyone help me?