Skip to content

labelAssociatedControls

Reports <label> elements without an associated control element.

✅ This rule is included in the jsx logical preset.

Form labels are a critical component of web accessibility. Screen readers and other assistive technologies rely on labels to identify and describe form controls. A label must be associated with a control element to provide this context.

This rule checks that all <label> elements have an associated control, either through:

  • An htmlFor prop that references the id of a control element
  • A control element nested within the label (input, select, textarea, meter, output, or progress)
<label />
<label>Name</label>
<label>
<span>Name</span>
</label>

If you are using a framework that handles label associations differently or automatically generates accessible labels, you can safely disable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.