Browse these fully functionning UWA widgets' code to understand their inner workings.
To get to the code, select the standalone version of the widget you are interested in, and display its code through your browser's appropriate option.