# input-requires-label

> Requires every <input> element to have an associated <label> for accessibility compliance.

All `<input>` tags must have a corresponding `<label>` tag.

Level: Warning

## Config value

[Section titled “Config value”](#config-value)

* `true`: enable rule
* `false`: disable rule

### The following patterns are **not** considered rule violations

[Section titled “The following patterns are not considered rule violations”](#the-following-patterns-are-not-considered-rule-violations)

```html
<input type="password">
<input id="some-id" type="password" /> <label for="some-other-id"/>
<input id="some-id" type="password" /> <label for=""/>
<input type="password" /> <label for="something"/>
```

### The following patterns are considered rule violations

[Section titled “The following patterns are considered rule violations”](#the-following-patterns-are-considered-rule-violations)

```html
<label for="some-id"/><input id="some-id" type="password" />
<input id="some-id" type="password" /> <label for="some-id"/>
```

### Why this rule is important

[Section titled “Why this rule is important”](#why-this-rule-is-important)

This rule ensures that the input element has a corresponding label element for accessibility compliance.

Further reading: [Axe Rules - input elements must have labels](https://dequeuniversity.com/rules/axe/4.1/label)