You are viewing this question as it will appear in the manual grading interface. Return to the normal view when you are done.

Element pl-units-input: Input of answers with units

Questions below were designed to showcase the different features of pl-units-input. The goal of pl-units-input is to allow users to enter real values with units. This element has similar behavior to the pl-number-input element, with the added benefit of being able to interact with units.

Within this question, you can observe the default behavior of the pl-units-input element. The submitted answer and reference solutions will be first be converted to base units and then compared. Submitting units of incorrect dimensionality will not be given any credit. The attribute initial-value fills the input the first time it renders to provide a suggested starting point.

What is the length of a meter stick?

Here, we've set grading-mode="exact-units", requiring units matching the reference solution exactly. The default input field has help text as a placeholder as well as a question button and is set to use "relabs" to check the tolerance, which is a combination of relative ("rtol") and absolute ("atol") tolerances. Make sure to include the unit suffix m to indicate that your answer is in meters.

What is the length of a meter stick?

This question modifies the default relative tolerance (of 1e-3) and absolute tolerance (of 1e-8) underneath pl-units-input element. Furthermore, we add a label to the front of the input field to specify what the field should receive.

Let $c$ be the length of a meter stick. What is the value of $c$?

$c = $

In this question, we opt to change the default comparison of pl-units-input from relative and absolute tolerances (comparison="relabs") to significant digits (comparison="sigfig"), which has a default of two digits. In addition, this question showcases some of the more complex units that this element can handle. We also remove the help popup box found in by setting show-help-text="false".

Let $g$ be the acceleration due to gravity at Earth's surface. What is the value of $g$?

$g = $

For this question, we only ask for units by setting grading-mode="only-units".

What is the acceleration due to gravity at Earth's surface?

$9.8$

This example shows the use of the attribute size to control the width of the input box. We also use placeholder="" and show-help-text="false". We have also set allow-feedback="False" to suppress feedback given to students, and custom-format=".2g" to show a fixed number of digits after the answer has been parsed.

Express the distance of one mile in feet (include unit).

Distance of 1 mile =

This example shows the use of the attribute allow-blank to allow students to leave this input blank. We set blank-value="1m" to customize the value used for the blank input. We also set show-score="false" to hide the score badge.

How long is a meter stick? Leave the box blank to submit "1 meter".

When allow-blank="true" is set, we can set blank-value="" (and potentially correct-answer="") to support truly empty answers as well.

How large is the wind? Leave the box blank if there is no correct answer.

Correct answer

1 meter
1 meter
$c = $ 1 meter
$g = $ 9.8 meter / second ** 2
$9.8$ meter / second ** 2
Distance of 1 mile = 5.28e+03 foot
1 meter

Student view placeholder

In student views this area is used for assessment and score info.
Tools

Staff information

Question

Title:
Element pl-units-input: Input of answers with units

Variant

Started at:
2026-08-04 23:51:28 (CDT)
Duration:
0s
Show/Hide answer
{
  "c_1": "1m",
  "c_2": "1m",
  "c_3": "1m",
  "c_4": "9.8 m/s**2",
  "c_5": "m/s^2",
  "c_6": "5280 foot",
  "c_7": "1m",
  "c_8": ""
}
History
dec frac
rad deg