Skip to content

prefer-button

Reports <input type="button">, type="submit", type="reset" and type="image".

A <button> can hold markup (an icon with text) and is styled like any other element; an <input> button shows only its value and has fewer ways to style.

To fix, use a <button> with the same type.

Reported
...
<button type="button">Go</button>
...
<input type="text" name="b">
<input type="submit" value="Go">
...
<video controls></video>
</body>
...
angular:
lint:
rules:
prefer-button: warn # off (default), warn, error
html:
lint:
rules:
prefer-button: warn # off (default), warn, error
svelte:
lint:
rules:
prefer-button: warn # off (default), warn, error
vue:
lint:
rules:
prefer-button: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended.

Suppress one line with sudsy-disable-next-line prefer-button in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
html-validate prefer-button full