In our application users/developers are able to build their own web layouts via editor. Therefor, they need to define container sizes with either percentage (%) or pixels (px). Currently, this choice can be made within the input field. I did not even know this until a co-worker told my about it - the placement of the unit choice within the input field was just not obvious to me and is difficult to learn for new users.
I came up with two alternative solutions:
(1) Choose the value's unit via toggle switcher
(2) Choose the value's unit via dropdown
One drawback I'm aware of is that the form starts to look more cluttered.
What are your experiences with use cases like this? What are your thoughts about these alternatives?