Got initial version working. At present no optimization involved, this will need to be done add for each ui element.
Added conditional rerender for toggle ui element