Helper

A function or class that computes a value for use in templates.

Since Ember 4/5 (Octane) Spec ↗

Syntax

helper(fn) | class X extends Helper { compute(positional, named) {} }

Returns

Helper — A template helper.

Examples

import { helper } from '@ember/component/helper';

export default helper(function fullName([first, last]) {
  return `${first} ${last}`;
});
// Modern: a plain function used directly in a template (gjs/gts)
function shout(text) {
  return text.toUpperCase();
}
// <template>{{shout @message}}</template>

Notes

Function-based helpers cover most cases; use a class-based Helper when you need services or lifecycle. In template tag (gjs/gts) components, plain JS functions can be invoked directly without registering a helper.