Number field

A typed number with its unit inside the field: dose, yield, a phase's duration, a pressure target.

HTML
<div class="bm-stage">
  <section class="bm-tile" style="width:366px">
    <div class="bm-grid2">
      <label class="bm-field"><span class="bm-field__label">Dose</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="decimal" value="18.0" aria-describedby="u1"><span class="bm-input__unit" id="u1" aria-label="grams">g</span></span></label>
      <label class="bm-field"><span class="bm-field__label">Yield</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="decimal" value="36.0" aria-describedby="u2"><span class="bm-input__unit" id="u2" aria-label="grams">g</span></span></label>
    </div>
    <label class="bm-field"><span class="bm-field__label">Target temperature</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="numeric" value="93" aria-describedby="u3 h3"><span class="bm-input__unit" id="u3" aria-label="degrees Celsius">°C</span></span><p class="bm-help" id="h3">80 to 100 °C.</p></label>
  </section>
  <section class="bm-tile" style="width:366px">
    <label class="bm-field"><span class="bm-field__label">Pressure</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="decimal" value="14.0" aria-invalid="true" aria-describedby="u4 e4"><span class="bm-input__unit" id="u4" aria-label="bar">bar</span></span><span class="bm-field__msg bm-field__msg--error" id="e4"><span data-icon="circle-alert" data-size="14"></span>Enter 0.0 to 12.0 bar.</span></label>
    <div class="bm-grid2">
      <label class="bm-field"><span class="bm-field__label">Flow limit</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="decimal" value="2.5" aria-describedby="u5"><span class="bm-input__unit" id="u5" aria-label="millilitres a second">ml/s</span></span></label>
      <label class="bm-field"><span class="bm-field__label">Standby after</span><span class="bm-inputwrap"><input class="bm-input bm-input--num" inputmode="numeric" value="30" aria-describedby="u6"><span class="bm-input__unit" id="u6" aria-label="minutes">min</span></span></label>
    </div>
  </section>
</div>
  • Use it in the profile editor, where a value is typed once. On the dashboard, a value nudged in small steps is a Stepper.
  • The unit is part of the field, not of the label: "Dose" with g inside, never "Dose (g)".

Anatomy

.bm-inputwrap holding input.bm-input.bm-input--num and .bm-input__unit. The number is right-aligned in body with tabular figures and ends space-12 from the right edge; the unit sits in that space in unit, ink-muted, UPPERCASE. Use type="text" with inputmode="decimal": it gives the numeric keyboard without the spinner arrows and the scroll-wheel changes of type="number".

States

The Field's states. An out-of-range value is an error when the field loses focus: danger border, circle-alert, and a sentence that states the range.

Content

QuantityUnit shownDecimalsTypical range
Temperature°C080 to 100
PressureBAR10.0 to 12.0
Dose, yieldG10.0 to 100.0
FlowML/S10.0 to 10.0
DurationS0 or 10 to 120
Standby afterMIN00 to 240
  • Accept a comma or a point as the decimal mark and show the point. Round to the decimals in the table when the field loses focus; never while typing.
  • State the range in the help line when it is not obvious ("80 to 100 °C") and repeat it in the error.
  • Empty is allowed only where the help says what empty means.

Keyboard and screen reader

  • The visible label names the field. Link the unit into the name with aria-describedby on the unit's id, so it reads "Dose, 18.0, grams": give the unit an aria-label with the word ("grams") since "G" alone is read as a letter.
  • Up and Down change the value by one step (0.1 or 1), Shift with them by ten. Do not trap the scroll wheel.