Skip to content

Parameters ​

p.* helpers create plain, serializable schema objects; the editor generates controls from them, and the spread builder infers render-context types from them. A spread declared as a plain object gets a broad context.

HelperValueOptions
p.booleanbooleandefault, shows (on a photo box: 'caption', see below)
p.integernumberdefault, min, max, step, unit (display only)
p.numbernumberdefault, min, max, step, unit (display only)
p.stringstringdefault, multiline, maxLength, placeholder, markdown (Formatted text)
p.enumone of optionsdefault, options (an array of values or a value-to-label map), optional labels for arrays
p.color#rrggbbdefault
p.dateISO date YYYY-MM-DDdefault, min, max, precision (day or month)
p.filefile ID, or '' when none is assignedaccept (lowercase extensions such as '.gpx'); see File parameters
p.listarray of items, each { id, ...fields }item (the fields), min, max, default (items, [] when omitted); see List parameters

Every parameter has a label and a default (p.file supplies '', p.list []); a saved value outside the constraints is reported and replaced by the default for rendering, but kept in project.json.

Any parameter, at any scope, may also have a description: plain help text of up to 1000 characters (trimmed, not empty), for people and agents alike. Say what the value means, which way it goes and when to change it, so an agent asked to "zoom the map out a bit" knows which parameter to lower:

ts
zoom: p.number({ label: 'Zoom', default: 1, min: 1, max: 8, step: .1,
  description: 'Higher values zoom in. 1 shows the whole route; 2 shows half its width.' }),

A yes/no parameter of a photo box that prints the photo's caption says so with shows: 'caption':

ts
hero: box.photo('Main photograph', { showCaption: p.boolean({ label: 'Show caption', default: false, shows: 'caption' }) }),

Print the caption with <ctx.Caption box="hero" />: it shows only while this parameter is on, and clicking it types the caption on the page (Photo captions on the page). Any placed photo's caption can also be edited from the page (Caption… beside the box's settings, Edit Caption… in its context menu). With shows, entering the first caption of a photo also switches the parameter on, as a caption would otherwise be saved and not printed. Changing a caption, or removing it, leaves the parameter alone. shows has no effect elsewhere, and ImageFlow 1.0.0-beta.24 and earlier ignore it.

Once any photo box of a template, on a spread or the cover, declares shows: 'caption', ImageFlow takes the template at its word: Caption… appears in the photo toolbar only on boxes with such a parameter or that render ctx.Caption, as a caption typed at a box that never prints it would look like a failed edit. Edit Caption… stays on every placed photo, since the caption belongs to the photo and may print elsewhere; at a box without the parameter its field says "This layout doesn't print captions." A template that never declares shows offers Caption… on every placed photo, as ImageFlow cannot tell which boxes print one. ImageFlow 1.0.0-beta.25 and earlier offer it everywhere.

Descriptions appear with the parameter's type, range, step, unit and options in get_authoring_context (under template) and in inspect_book's parameter view. In the editor, a field shows its parameter's description only as its hover tooltip, so the settings stay uncluttered; write it for agents first. A description on a controls entry is shown under the field instead and replaces it there; control descriptions have the same limits. Descriptions never change defaults, allowed values or saved data. Put units in unit, not in the description.

Scopes: parameters at template level (document), on a spread definition (spread instance), on a box or element (element instance). Values are stored in project.json at the matching scope. There is no inheritance between scopes.