SemText

Reference · NPL

<npl-flag>

NPL element

PromptLingo reference ↗

You give it a name and a value. The reader can click the row to apply the setting. If the name implies a number range, values outside it are flagged.

One setting a reader can switch, shown as a labelled row. You give it a name and a value. The reader can click the row to apply the setting. If the name implies a number range, values outside it are flagged. required, no default. Flag identifier; its wording implies the numeric range checked on `value` (below). no default. Rendered verbatim; validated only when the name implies a numeric range (case-insensitive substring of the name): `freq` checks [0.0, 1.0] (frequency flags), `factor` checks [-10, 10] (hormone factors), `threshold` must be numeric and unbounded. Any other name (pump switches, meta, …) is free-form — never validated. An out-of-range or non-numeric value is NOT an error: the flag renders with the `npl-flag-invalid` warning class on its value span. per the global attribute catalog (conventions.md §2) per the global attribute catalog (conventions.md §2) per the global attribute catalog (conventions.md §2)

Example

npl-flag.html
source
1 <npl-flag name="calm_factor" value="0.5"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: name contains "freq"

A name containing freq checks the value against [0.0, 1.0]; 0.25 is in range, so the value span renders clean.

variant: name contains "freq"
npl-flag-freq-in-range.html
source
1 <npl-flag name="tick_frequency" value="0.25"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: out-of-range value

factor checks [-10, 10] — 42 is out of range. This is not an error: the value renders verbatim with the npl-flag-invalid warning class and stays fully readable.

variant: out-of-range value
npl-flag-factor-out-of-range.html
source
1 <npl-flag name="calm_factor" value="42"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: name contains "threshold"

A threshold must be numeric but is unbounded — any number renders clean, only non-numeric values are marked invalid.

variant: name contains "threshold"
npl-flag-threshold-unbounded.html
source
1 <npl-flag name="panic_threshold" value="999"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: free-form name (never validated)

No freq/factor/threshold in the name — pump switches and meta flags take any value verbatim, with no range check.

variant: free-form name (never validated)
npl-flag-free-form.html
source
1 <npl-flag name="pump_switch" value="on"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: data-* alias spelling

The class/dual form of the contract: data-name and data-value are the same parameters, and the data-* spelling wins when both are authored.

variant: data-* alias spelling
npl-flag-data-alias.html
source
1 <npl-flag data-name="calm_factor" data-value="0.5"></npl-flag>
render

Live render boots with JavaScript — the authored source is alongside.

variant: inside npl-flags

The usual context — flags as children of a preset-flagged npl-flags container, with note text beside them. Each flag stays individually click-to-apply.

variant: inside npl-flags
npl-flag-in-container.html
source
1 <npl-flags preset="production">
2 <npl-flag name="calm_factor" value="0.5"></npl-flag>
3 <npl-flag name="tick_frequency" value="0.25"></npl-flag>
4 Tuning for long-running sessions; apply per flag as the run proceeds.
5 </npl-flags>
render

Live render boots with JavaScript — the authored source is alongside.

Source: spec/schema/npl/npl-flag.md