How to swap material using widget?

I am looking some thing like this…But I am not understanding the language