This content originally appeared on Go Make Things and was authored by Go Make Things
Recently I was working on a creating some form components in React and Next.js for one of my subscription engineering clients, helping get a bit consistency across their UI components.
After building out a <select>
component based on its use across their existing site, the client asked (I’m paraphrasing)…
Could we add support for
<optgroup>
if anitem
has an array instead of a string as its property value?
It’s not an unreasonable ask. It would make the component a lot more flexible.
But the existing UI doesn’t use that pattern anywhere currently. Maybe it should. Maybe it shouldn’t.
But that’s the conversation I’d want to have first.
Are there places in the UI where
<select>
menus are unwieldy because they have too many options? If so, should we use<optgroup>
elements to break them into sections, or is there a better way to handle that UI that’s simpler for the user?
Optimizing your code is great!
Optimizing it for an imagined future need that may never come to be, though, just results in code that’s more complex, harder to read, harder to use, and harder to maintain.
Need help with your project? Get in touch.
Like this? A Lean Web Club membership is the best way to support my work and help me create more free content.
This content originally appeared on Go Make Things and was authored by Go Make Things

Go Make Things | Sciencx (2025-08-27T14:30:00+00:00) Wait until you need it. Retrieved from https://www.scien.cx/2025/08/27/wait-until-you-need-it/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.