ember/template-require-button-type

April 20, 2026 ยท View on GitHub

๐Ÿ’ผ This rule is enabled in the ๐Ÿ“‹ template-lint-migration config.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

This rule requires all <button> elements to have a valid type attribute.

By default, the type attribute of <button> elements is submit. This can be very confusing, when a button component is developed in isolation without type="button", and when inside a <form> element it suddenly starts to submit the form.

Examples

This rule forbids the following:

<template>
  <button>Hello World!</button>
  <button type=''>Hello World!</button>
  <button type='invalid'>Hello World!</button>
</template>

This rule allows the following:

<template>
  <button type='button'>Hello World!</button>
  <button type='submit'>Hello World!</button>
  <button type='reset'>Hello World!</button>
</template>

References