Can someone please explain to me how the User Card pop-up works?

Trying to understand how the user card is wired in so I can ultimately code the same behaviour in a plug-in.