Taffrail Var

HTML Advice content includes Web Components.

When requesting HTML Advice content, the API will return HTML strings containing Web Components (custom HTML elements) named taffrail-var which reference individual Variables. These elements have several attributes useful for developing interactive user interfaces.

๐Ÿ‘

Requesting HTML

To request formatted HTML, use the +html modifier on the Accept header as follows.

Accept: application/vnd.taffrail.json+html

Inspecting an ADVICE item in the advice[] list, the following properties would be present. In the headline_html field, look for the <taffrail-var> HTML element.

{
  "headline": "Because your income is above $198,000, you are not eligible for a Roth IRA and should consider a Traditional IRA instead."
  "headline_html": "Because <a href=\"#Roth_Eligibility\" data-variable-id=\"EbAx0DxX9Bm490AALrEPV\" class=\"taffrail-var\"><taffrail-var data-variable-type=\"Freetext\" data-variable-name=\"Roth_Eligibility\" data-variable-id=\"EbAx0DxX9Bm490AALrEPV\" data-variable-raw-value=\"Income too high for a Roth\">your income is above <taffrail-var data-variable-type=\"Number\" data-variable-format=\"$0,0\" data-variable-name=\"IRS_Limit_Roth_MFJ_Income_Low\" data-variable-id=\"Bj09EXCZkhOiKxdsa4UaL\" data-variable-raw-value=\"198000\">$198,000<\/taffrail-var><\/taffrail-var><\/a>, you are not eligible for a Roth IRA and should consider a Traditional IRA instead.\n"
}

๐Ÿ“˜

Demo

Try this on the Advice Content Types page.

In HTML mode, every Variable is wrapped with a <taffrail-var> element. The following data- attributes can be found on each element.

These properties correspond to the Variable meta.

  • data-variable-type The data type of that Variable (see also: Form Templates)
  • data-variable-name The canonical name of the Variable
  • data-variable-id The unique Variable ID, useful to lookup in the API's variables property
  • data-variable-raw-value The raw, unformatted value of the Variable
  • data-variable-format The formatting string for the Variable, see Variables: Format for more.
  • data-variable-is-undefined This exists only if an Unknown Variable Reference error occurs (e.g., #VARIABLE_NAME!)
  • data-variable-system This exists only if true and indicates a "system" Variable
  • data-variable-constant This exists only if true and indicates a "constant" Variable, one that should not change
  • data-variable-is-toggleable This exists only if true and indicates a Variable is toggleable.
  • data-backlink-name The canonical name of the Backlink
  • data-backlink-required A boolean to indicate a Backlink chip should be rendered in the user interface.