This is how I built my UI system in my functional game engine - https://github.com/bryanedds/NuGameEngine
More detail - https://github.com/bryanedds/NuGameEngine/blob/master/Nu/Doc...