Skip to content

useButtonType (HTML)

biome.json
{
"linter": {
"rules": {
"a11y": {
"useButtonType": "error"
}
}
}
}

Enforces the usage and validity of the attribute type for the element button

<button>Do something</button>
code-block.html:1:1 lint/a11y/useButtonType ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide an explicit type attribute for the button element.

> 1 │ <button>Do something</button>
^^^^^^^^
2 │

The default type of a button is submit, which causes the submission of a form when placed inside a `form` element.

Allowed button types are: submit, button or reset

<button type="incorrectType">Do something</button>
code-block.html:1:1 lint/a11y/useButtonType ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide a valid type attribute for the button element.

> 1 │ <button type="incorrectType">Do something</button>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

The default type of a button is submit, which causes the submission of a form when placed inside a `form` element.

Allowed button types are: submit, button or reset

<button type="button">Do something</button>