Question type

number

A single numeric input. Six visual styles — from a plain input to sliders, steppers, and a dial — covering everything from currency to NPS.

What number is

number collects one numeric value. The respondent types or picks a number; the runtime stores it as a number. min and max constrain the value range, not the count of selections — there’s only ever one value. Decimal entry is off by default; turn it on with decimal: True.

Mockup preview
QAge number input
How old are you?
- qid: QAge
    type: number
    text: How old are you?
    label.suffix: years
    min: 13
    max: 120

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typenumberRequired.
title, text, instructionrenderableVisible content. Use {{ }} to pipe runtime values. HTML allowed.
requiredTrue | FalseDefault True.
default.errorsTrue | False | custom stringDefault True.
validationcode blockPython; call fail() to reject. No default.
readonlyTrue | FalseDefault False. Set True to render the question but disable input — the respondent sees it but can’t change the value. Pair with visibility: hide to fully hide a helper question.
visibilityshow | hideDefault show.
styleinput | slider | sliderTicks | stepper | dial | dropdownDefault input. See Styles below.
minnumberLower bound on the value. No default — unbounded unless set.
maxnumberUpper bound on the value. No default — unbounded unless set.
decimalTrue | FalseDefault False. Set True to allow fractional values.
decimal.placesintegerCap precision when decimal: True. No default — unlimited.
label.prefixstringDecoration on the left of the input (e.g. $).
label.suffixstringDecoration on the right (e.g. years, %).
input.sizeintegerWidth of the input box in characters. Default sizes itself to the container.
input.sourcedefault | jsDefault default. Set js for JS-fed values.
customcode blockCustom runtime block. No default.

Skin-specific properties

These properties only have effect under a specific style:. Setting them with any other style is ignored.

PropertyUsed withValuesNotes
stepper.stepstyle: steppernumberIncrement per − / + press. Default 1. Set higher (e.g. 5, 6) when the respondent should jump by larger amounts.
slider.ticksstyle: sliderTicksconfigurationTick-mark configuration along the slider — count, labels, position. See Skin variants for the full shape.

Methods & accessors

Accessors

ExpressionReturnsMeaning
Q.valuenumberThe numeric answer. None if unanswered.
Q.answeredboolTrue once the respondent has entered a value (or a script set one).
Q.notAnsweredboolInverse of answered.

Methods

ExpressionReturnsMeaning
Q.set(N)NoneSet the value to a number (integer or float). Used in scripts on hidden helpers.
Q.reset()NoneClear the value.

number.set() accepts a number — integer or float (when decimal: True). Strings are rejected; for textual input use open.

Numeric operations on Q.value

Q.value is a Python number, so the standard arithmetic and comparison operators are available:

ExpressionReturnsMeaning
Q.value > 18boolGreater than.
Q.value <= 65boolLess than or equal.
Q.value == 0boolEquality.
Q.value % 6 == 0boolMultiple-of check via modulo.
abs(Q.value)numberAbsolute value.
round(Q.value)numberRound to nearest integer.
round(Q.value, 2)numberRound to 2 decimal places.

See Builtins & operators for the full math reference.

Skins

Six visual styles. Pick by the value’s range, the device, and the authoring intent.

input Input (default)
42 |
Plain numeric input field. Default. Best for any value where the respondent should type.
slider Slider
0100
Range slider. Best for bounded continuous values. Mobile-friendly.
sliderTicks Slider + Ticks
7
Large value display with a styled slider and tick marks below. Mobile-friendly.
stepper Stepper
− 5 +
− / + buttons. Best for small integer ranges on mobile.
dial Dial
8
Arc dial for 0–10 or 0–100 NPS-style questions.
dropdown Dropdown
10 ▾
Select from a list of numeric values between min and max. Best for short integer ranges.

The exact appearance is driven by theme tokens — colours, radii, fonts. See Customisation and Skin variants.

See it work

A working preview using each interactive style. Type, drag, or tap.

Input

Mockup preview
QSpend number input
How much did you spend last month?
Live state
QSpend.answeredFalse
QSpend.valueNone
QSpend.selected{}
QSpend.selectedLabelNone
QSpend.selected.size0
Live state
QSpend.answeredFalse
QSpend.valueNone
- qid: QSpend
    type: number
    text: How much did you spend last month?
    label.prefix: $
    min: 0
    max: 10000

Slider

Mockup preview
QNps number slider
How likely are you to recommend us? (0 = least, 10 = most)
Live state
QNps.answeredFalse
QNps.valueNone
QNps.selected{}
QNps.selectedLabelNone
QNps.selected.size0
Live state
QNps.answeredFalse
QNps.valueNone
- qid: QNps
    type: number
    text: How likely are you to recommend us?
    style: slider
    min: 0
    max: 10

Stepper

Mockup preview
QPeople number stepper
How many people are in your household?
Live state
QPeople.answeredFalse
QPeople.valueNone
QPeople.selected{}
QPeople.selectedLabelNone
QPeople.selected.size0
Live state
QPeople.answeredFalse
QPeople.valueNone
- qid: QPeople
    type: number
    text: How many people are in your household?
    style: stepper
    min: 1
    max: 20

Methods & accessors — live

Type a value below and watch each expression evaluate.

Mockup preview
QAge number input
Enter an age.
Methods & accessors — live
QAge.answered → —
QAge.notAnswered → —
QAge.value → —
QAge.value > 18 → —
QAge.value >= 65 → —
QAge.value < 13 → —
QAge.value % 5 == 0 → —

A few things to notice:

  • value is a number, not a string. Pick 42 and value is 42, not "42". Compare with unquoted numbers: QAge.value > 18, not > "18".
  • value is None when unanswered. All comparisons against None evaluate False, so QAge.value > 0 won’t accidentally match an unanswered question — but it also won’t match the inverse. Use QAge.answered as the explicit gate when needed.
  • Comparisons compose. if 18 <= QAge.value <= 65: … is the natural Python way to check a range — same syntax in scripts and if: properties.

Examples

Currency input

- qid: QSpend
    type: number
    text: How much did you spend last month?
    label.prefix: $
    label.suffix: USD
    decimal: True
    decimal.places: 2
    min: 0

label.prefix and label.suffix decorate the input visually; they don’t affect the stored value (still a number). decimal: True plus decimal.places: 2 allows two decimal places — perfect for currency.

Likelihood scale (NPS)

- qid: QNps
    type: number
    text: How likely are you to recommend us?
    style: slider
    min: 0
    max: 10

- qid: hNpsBucket
    type: single
    options:
        1: Detractor
        2: Passive
        3: Promoter
    visibility: hide
    readonly: True
    required: False

- script: |
    if QNps.value <= 6:    hNpsBucket.set(1)   # Detractor
    elif QNps.value <= 8:  hNpsBucket.set(2)   # Passive
    else:                  hNpsBucket.set(3)   # Promoter

The slider style is a natural fit for 0–10 NPS scales. The hidden helper question hNpsBucket derives the standard NPS bucket from the score, so analysts get a clean categorical column alongside the raw score.

Age gate

- qid: QAge
    type: number
    text: How old are you?
    label.suffix: years
    min: 13
    max: 120

- script: |
    if QAge.value < 18:
        endSurvey(status="terminate", redirect="https://example.com/under18")

min: 13 rejects nonsensical entries at the input level; the script-level termination handles “valid number but doesn’t qualify”.

Range validation with custom message

- qid: QYears
    type: number
    text: How many years of experience do you have?
    label.suffix: years
    min: 0
    max: 60
    validation: |
        if QYears.value > 50:
            fail("Please double-check — that seems unusually high.")

min/max enforce hard bounds; validation: adds soft checks with custom messages. Both run, with min/max first.

Multiple-of constraint

- qid: QQuantity
    type: number
    text: How many cases? (must be a multiple of 6)
    style: stepper
    stepper.step: 6
    min: 0
    max: 600
    validation: |
        if QQuantity.value % 6 != 0:
            fail("Please enter a multiple of 6.")

stepper.step: 6 makes the +/- buttons jump by 6 — guides the respondent toward valid values. The validation: block is a defensive backstop in case the field is edited in some other way.

Hidden numeric helper

- qid: QAge
    type: number
    text: How old are you?
    min: 13
    max: 120

- qid: hAgeBand
    type: number
    visibility: hide
    readonly: True
    required: False

- script: |
    if QAge.value < 25:    hAgeBand.set(1)
    elif QAge.value < 45:  hAgeBand.set(2)
    elif QAge.value < 65:  hAgeBand.set(3)
    else:                  hAgeBand.set(4)

A bucketed age value alongside the raw age. Both export.

Conditional follow-up

- qid: QSpend
    type: number
    text: How much did you spend last month?
    label.prefix: $

- qid: QSpendDetail
    type: open
    text: What was that mostly on?
    if: QSpend.value > 100
    style: textarea

QSpendDetail only shows when the spend is over $100. Numeric comparisons in if: are clean and read like English.

Export

number exports as a single column:

WhatColumn
The numeric valueqid (e.g. QAge) — number

Empty answers (when required: False and the respondent leaves it blank) export as null. Decimal values respect decimal.places — extra digits are truncated.

See also