change the property ui to be a function to be able to use it in the same way as events