Convert setup of custom ui element to take an object as a parameter.