Optgroups
Optgroups are a feature of HTML select inputs used to organize a long list of options into labeled categories. They help users navigate complex option lists by providing a clear, logical structure within a dropdown.
The optgroup element is placed inside a select and contains one or more option elements. The label
Accessibility considerations support the use of optgroups. Screen readers announce the group label, helping users understand
Styling and behavior considerations include limited customization of optgroup labels, which can render differently across browsers.
Use cases for optgroups include organizing large lists such as selecting countries by region, categorizing product
In summary, optgroups provide a native, accessible way to categorize options within a select element, improving