It's called a trackstand.
I never do it without unclipping at least one foot (anymore
), especially not when in a position where I could land with my head in front of a car if I do fall.
You basically have to learn to make tiny adjustments in your center of gravity to correct if you start to lean one way or the other. To practice, find a slight incline and practice riding up it as slowly as possible. You'll find that it's pretty natural if you start to go too far one way or the other to turn your front tire to compensate or pedal a fraction of stroke to get back a tiny bit of speed. As you get better you'll find it possible to come to a complete stop for increasing lengths of time.
Good luck! It's kind of fun when you get a good stand and you know people are watching.