Is it appropriate for an undergrad to friend grad students / postdocs on social media? I'm guessing that if the grad student / postdoc is directly supervising the undergrad, friending would not be very appropriate. However, would it be ok for an undergrad to friend other grad students / postdocs in the lab?

This is for a university in the U.S.
I don't think there is a general social media rule about this. I have had many undergraduate friends on social media during my Ph.D. and postdoc. My rule is to send friend requests to whoever you like. It is just a request, they don't have to accept it. If someone sends me a friend request and I don't care to be their friend, I just ignore it.

But if you're worried that it could get awkward, you can just ask them if it is okay with them before sending a request.