According to this article, it states
Placing options in a selector drop-down requires two clicks, and hides the options. Use an input selector if there are over 5 options.
Please write answers explaining the cases when the 5 works and when it does NOT.
The easiest way to understand this is to think in terms of the simplest visual patterns of groupings, in which 5 is a magic number, because everything in a list of 5 has a perfectly describable and consciously recognisable place.
Let me try to use words to demonstrate this, and imagine vertical, though horizontal is much the same.
Each position is perfectly mentally understood as either:
Top, bottom, middle
Next to top and above middle
Next to bottom and below middle
This makes 5 objects the largest list of absolute positions instantly identifiable and classifiable by the viewer.
Got 6 items, there is no middle. A huge loss of reference.
At 7 items there are two objects between the top and the middle, the middle and the bottom. Much ambiguity.
Even 4 numbers is less preferable because the middle two objects are muddied in mental descriptiveness by the lack of a true middle.
Hence the magic of a list of five.
It's because of one of the vital UX Law called as Miller's Law.
George Armitage Miller (Princeton Professor and Cognitive Psychologist) formulated a law based on his observations and findings in his the theory of communication, which states that :
The number of objects an average human can hold in working memory at a single glance is 7 ± 2.
Which means, normal people can only be able to keep five to nine items in their short-term memory before they forgot or had errors.
So, for better accessibilities and compatibilities it is always advisable to present 5 i.e. (7-2) objects in front of the users. This law both assist in the usability / experience of design as well as the aesthetic values. Henceforth, the magic number is 5.
But be informed that there are variety of cases where Miller's law has been used to justify limiting number of items in an interface or Display.