ember/template-no-element-event-actions
February 20, 2026 ยท View on GitHub
Disallow using element event actions (e.g., onclick={{action}}) in templates. Use the {{on}} modifier instead.
Rule Details
This rule disallows the use of element event actions in templates.
Examples
Examples of incorrect code for this rule:
<template>
<button onclick={{this.handleClick}}>Click</button>
</template>
<template>
<div onmouseenter={{this.handleHover}}>Hover</div>
</template>
Examples of correct code for this rule:
<template>
<button {{on "click" this.handleClick}}>Click</button>
</template>
<template>
<div {{on "mouseenter" this.handleHover}}>Hover</div>
</template>
Options
| Name | Type | Default | Description |
|---|---|---|---|
requireActionHelper | boolean | false | When true, only flags events using {{action ...}}; when false, flags any dynamic value on event attributes. |