ReferencetextInput

<textInput/>

<textInput/> is an Input component that renders a form input field for text responses from the user.

Attributes and Properties

Attributes for <textInput>
AttributeTypeValues
anchor = "…"point
bindValueTo = "…"
draggable = "…"boolean"true" "false"
expanded = "…"boolean"true" "false"
forAnswer = "…"
height = "…"componentSize
labelIsName = "…"boolean"true" "false"
positionFromAnchor = "…"text"upperright" "upperleft" "lowerright" "lowerleft" "top" "bottom" "left" "right" "center"
prefill = "…"text
width = "…"componentSize
Props for <textInput name="t">
PropertyType
$t.anchorpoint
$t.characters[ text ]
$t.collaborateGroupscollaborateGroups
$t.disabledboolean
$t.draggableboolean
$t.expandedboolean
$t.fixedboolean
$t.fixLocationboolean
$t.heightcomponentSize
$t.hiddenboolean
$t.immediateValuetext
$t.immediateValueChangedboolean
$t.labellabel
$t.labelIsNameboolean
$t.list[ text ]
$t.numCharactersinteger
$t.numListItemsinteger
$t.numWordsinteger
$t.positionFromAnchortext
$t.prefilltext
$t.shortDescriptiontext
$t.texttext
$t.valuetext
$t.valueChangedboolean
$t.widthcomponentSize
$t.words[ text ]

Example: Default <textInput/>

The default <textInput/> blank is wide enough for approximately 2-4 words to be visible at a time.


Example: Large <textInput/>

The expanded <textInput/> blank is approximately large enough for 4-6 sentences to be visible at a time.


Example: <textInput/> with <label> child

The <textInput/> component can take a nested <label> child.


Example: <textInput/> for graded free-response

The <textInput/> can be nested in an <answer> with the handGraded attribute for graded free-response style questions.


Example: <textInput/> for graded closed-form text response

The <textInput/> can be nested in an <answer> with the handGraded attribute for graded free-response style questions.


Example: <textInput/> on a <graph>

A <textInput/> can be placed on a <graph>. Use the anchor attribute to adjust its starting location. Click on the border of the <textInput/> to drag it around.


Attribute Example: prefill

The prefill attribute specifies initial text for the <textInput/>.


Attribute Example: expanded

The expanded attribute renders a larger <textInput/> space. The dimensions of the input space can be further customized with the height and width attributes.


Attribute Example: forAnswer

Specifying the attribute forAnswer of a <textInput> does two things:

  1. It colors the border of the text input based on the correctness of the response (assuming colorCorrectness is not set to false).
  2. It includes the value of the text input as a response of the answer.

Attribute Example: width

The default width of the input space can be customized with the width attribute.


Attribute Example: height

The default height of the input space can be customized with the height attribute. This must be used in combination with the expanded attribute.


Attribute Example: labelIsName

The labelIsName attribute can be used to assign an automatic label to a <textInput/>.


Attribute Example: draggable

The draggable attribute can be set to false to prevent users from moving the <textInput/> on a <graph>.


Property Example: value

The value property contains the finalized value the user entered into the input. It is updated when the user presses enter or navigates away.


Property Example: immediateValue

The immediateValue property contains the value the user enters into the input as they are typing.


Property Example: attributes as properties

The attributes illustrated in the example are also accessible as properties. The value stored in a <label> child can also be rendered using the label property.