<input>
<input> is a text field the player can type into — a search box, a rename
prompt, a chat line.
<input x={4} y="center" w={{ fill: 8 }} h={16} font={Fonts.PLAIN} text="selling rune scimitar" valign="middle" shadowReference
Section titled “Reference”<input>
Section titled “<input>”<input> accepts all
common props, plus everything
<text> accepts — text, font,
color, align, valign, shadow, lineHeight, altText — and:
focus: A boolean. Whether this field has the caret when the interface opens. A field without focus does not receive typing.selectColor: A number, as0xRRGGBB. Colour of selected text.selectBgColor: A number. Background behind selected text.promptColor: A number. The caret’s colour.lineWrapWidth: A number. Width at which the text wraps.lineCountLimit: A number. Maximum number of lines.lineWidthLimit: A number. Maximum characters per line.deferred: A boolean. Leave the definition’s value for this field’s state-reading props until the state first moves — see common props.
Caveats
Section titled “Caveats”- An
<input>needs afont(TS2E219). - What the player types stays in the field.
textis the initial contents, and it is written, never read:ref.textis refused (TS2E003). For a value the panel uses, hear the keys withonKeyand build the value in a cell — Keyboard and input. - Only one field can hold focus at a time.
<input ref={box} x={0} y={0} w="fill" h={16} text="" font={Fonts.PLAIN} color={Colors.WHITE} focus /><text ref={echo} x={0} y={20} w="fill" h={16} text="?" font={Fonts.PLAIN} color={Colors.AMBER} onClick={() => { echo.text = box.text; }} />A chat line
Section titled “A chat line”<layer x={0} y={116} w="fill" h={22}> <SunkenBox> <input x={4} y="center" w={{ fill: 8 }} h={16} font={Fonts.PLAIN} text="selling rune scimitar" valign="middle" shadow color={Colors.YELLOW} promptColor={Colors.DIM} selectColor={Colors.WHITE} selectBgColor={0x3d5a8a} lineWidthLimit={40} focus /> </SunkenBox></layer>An <input> draws no border of its own.
A number the panel can read
Section titled “A number the panel can read”<text x={0} y={22} w="fill" h={16} text={`${amount}*`} font={Fonts.PLAIN} align="center" valign="middle" shadow color={Colors.WHITE} onKey={(event) => {Not an <input> at all: a <text> with an onKey, drawing a cell the handler
writes.
Troubleshooting
Section titled “Troubleshooting”Nothing happens when I type
Section titled “Nothing happens when I type”Check focus. A field without it does not receive keys, and only one field can
have it.
The field is invisible
Section titled “The field is invisible”Check font. An <input> without one does not lay out.
I want to read what was typed
Section titled “I want to read what was typed”You cannot. Hear the keys with onKey on the element instead, and build the
value in a cell — Keyboard and input
shows the prompt.