Conditional form


I have a dropdown. Based on the value selected, I want to display different types of form elements. For instance, if A is selected, display 1 textarea, if B is selected, display 1 dropdown and 1 input.

I sense it could be possible using the hidden property but isn't there any smoother way and even so the question of positioning remains: I would get gaps of space and this obviously doesn't scale.

Am I missing something?