You can check the “Main Widget” project, which autogenerates your UI.
openHAB 4 version will be published soon, stillneed to prepare the docs.