Edit Page

Computed fields

A computed field is a property of a Card content-type that can be recalculated as data changes.

The computed field could do complex processing, or something as small as returning whether an article has been published, as shown in this example in the Cardboard project:

exports.type = '@cardstack/core-types::boolean';

exports.compute = async function(model) {
  let publishedDate = await model.getField('published-date');

  return !publishedDate;

To find other examples of Computed fields, search for the computed-field-types directory within a project like Cardboard or Card Folio.