Skip to content

<optgroup> - The Option Group Element

Form Control HTML 4.0

The optgroup element groups related options within a <select> dropdown menu. It creates visual categories with labels that help organize long lists of options.

Result
<select name="field">
<optgroup label="Group Name">
<option value="value1">Option 1</option>
<option value="value2">Option 2</option>
</optgroup>
</select>

The label attribute provides the heading for the option group.

AttributeDescriptionExample
labelLabel for the option group (required)label="Category"
disabledDisables all options in the groupdisabled
Result
Result
Result
Result
Result
Result
Result
Result
Result
<select name="city">
<optgroup label="California">
<option value="la">Los Angeles</option>
<option value="sf">San Francisco</option>
<option value="sd">San Diego</option>
</optgroup>
<optgroup label="Texas">
<option value="houston">Houston</option>
<option value="austin">Austin</option>
<option value="dallas">Dallas</option>
</optgroup>
</select>
<optgroup label="Europe">

If you only have 3-5 options total, grouping may be unnecessary:

<select name="priority">
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
</select>

Screen readers announce the group label before each option, helping users understand the context:

<optgroup label="Breakfast Items">
<option value="eggs">Eggs</option>
<option value="pancakes">Pancakes</option>
</optgroup>

Screen reader announces: “Breakfast Items, Eggs” and “Breakfast Items, Pancakes”

Remember that <optgroup> labels are headers, not selectable options:

Result

When disabling a group, make it clear why:

<select name="plan">
<optgroup label="Standard Plans">
<option value="basic">Basic</option>
<option value="pro">Pro</option>
</optgroup>
<optgroup label="Enterprise (Contact Sales)" disabled>
<option value="team">Team</option>
<option value="enterprise">Enterprise</option>
</optgroup>
</select>
BrowserVersionNotes
Chrome1+Full support
Firefox1+Full support
Safari1+Full support
Edge12+Full support
IE5.5+Full support

The <optgroup> element has been widely supported since IE 5.5 and early versions of other browsers.