Implement copy code feature

Hey everyone, so I want to implement the box code which also ha the copy code feature similar to the attached picture below. Do I need a custom code or is there any easy way.