Add User via a custom widget

is there any way we can mimic this functionality on widget level of listing user and selecting users and storing the userids