Hyperview

Hyperview

  • Guides
  • Examples
  • Reference
  • Blog

›Input Elements

Reference

  • Index

Behaviors

  • Behavior Attributes
  • <behavior>
  • Alert
  • Share

Display Elements

  • <doc>
  • <screen>
  • <header>
  • <body>
  • <view>
  • <text>
  • <image>
  • <list>
  • <section-list>
  • <section>
  • <section-title>
  • <items>
  • <item>
  • <spinner>
  • <web-view>

Input Elements

  • <form>
  • <text-field>
  • <select-single>
  • <select-multiple>
  • <option>
  • <picker-field>
  • <picker-item>
  • <switch>
  • <date-field>

Style Elements

  • <styles>
  • <style>
  • <modifier>

Hyperview Client

  • Hyperview component
  • Custom elements
  • Custom behaviors
  • Loading Screen

Hyperview Navigation

  • <navigator>
  • <nav-route>

<text-field>

The <text-field> element represents a single-line input field. When pressed, the field focuses and a keyboard appears to accept user input. The value entered into the <text-field> get serialized as form data when a <form> gets submitted.

<form>
  <text-field name="name" placeholder="Your name" value="Bart" />
  <text-field
    name="phone"
    placeholder="Your phone number"
    mask="(999) 999-9999"
    keyboard-type="phone-pad"
  />
</form>

Structure

A <text-field> element can appear anywhere within a <form> element.

Attributes

  • name
  • value
  • placeholder
  • placeholderTextColor
  • selectionColor
  • cursorColor
  • multiline
  • keyboard-type
  • mask
  • style
  • id
  • hide
  • auto-focus
  • secure-text
  • text-content-type
  • allowFontScaling
  • maxFontSizeMultiplier
  • minimumFontScale

Behavior attributes

A <text-field> element accepts the standard behavior attributes, including the following triggers:

  • blur
  • change
  • focus

name

TypeRequired
stringYes

The name of the field within a <form> element. This name will be used when serializing a form to form data that gets sent in a server request.

value

TypeRequired
stringNo (defaults to blank)

The value of the field. This string gets rendered into the string and can be edited by the user. Set this value in the XML to pre-populate the text field.

placeholder

TypeRequired
stringNo

A label that appears within the text field. The placeholder only appears when the field is empty.

placeholderTextColor

TypeRequired
stringNo

The text color of the placeholder string.

selectionColor

TypeRequired
stringNo

The highlight, selection handle and cursor color of the text input.

selectionHandleColor (Android)

TypeRequired
stringNo

Sets the color of the selection handle. Unlike selectionColor, it allows the selection handle color to be customized independently of the selection's color.

cursorColor (Android)

TypeRequired
stringNo

When provided it will set the color of the cursor (or "caret") in the component. Unlike the behavior of selectionColor the cursor color will be set independently from the color of the text selection box.

multiline

TypeRequired
false (default), trueNo

When true, allows the text input to have multiple lines.

keyboard-type

TypeRequired
stringNo (defaults to default)

Sets the type of keybaord to show when the user focuses the input. Supported options:

  • default: Standard alpha-numeric keyboard
  • number-pad: Keyboard restricted to 0-9 digits plus decimals
  • decimal-pad: Keyboard restricted to 0-9 digits with no decimals
  • phone-pad: Keyboard restricted to digits and symbols that appear in phone numbers
  • email-address: Keyboard adapted for easier email address input (handy @ symbol)
  • url: Keyboard adapted for easier URL input (., / and .com in place of space bar)
  • ascii-capable(iOS only): Similar to the default keyboard, without emojis
  • numbers-and-punctuation(iOS only): Keyboard that opens by default on the page with numbers and punctuation. User can switch back to first page showing alphabetical characters.
  • name-phone-pad(iOS only): Keyboard that opens by default on the page with alphabetical characters, where user can switch to second page showing a phone pad (useful to search for contacts, either by their name, or phone number).
  • twitter(iOS only): Keyboard with @ and # keys in place of "Return" key
  • web-search(iOS only): Keyboard with "Go" key im place of "Return" key

mask

TypeRequired
stringNo

A mask string that formats the user's input. If specificed, on every keystroke the input will be formatted using the mask, which may add characters to the field or prevent the pressed key from being set. Mask format:

  • 9: Accept numbers
  • A: Accept alpha
  • S: Accept alphanumerics
  • *: Accept all

All other characters will automatically appear in the mask when the format is satisfied. For example:

<text-field name="phone" mask="(999) 999-9999" />

If the user types a 4, the field will show (4. If the user tries to type the letter A, the field will still show (4.

style

TypeRequired
stringNo

A space-separated list of styles to apply to the element. See Styles. Note that text style rules cannot be applied to an <text-field>.

<text-field> supports the focused style modifier. See Modifiers for more details.

id

TypeRequired
stringNo

A global attribute uniquely identifying the element in the whole document.

hide

TypeRequired
false (default), trueNo

If hide="true", the element will not be rendered on screen. If the element or any of the element's children have a behavior that triggers on "load" or "visible", those behaviors will not trigger while the element is hidden.

auto-focus

TypeRequired
false (default), trueNo

If auto-focus="true", the element will steal focus the moment it's rendered.

secure-text

TypeRequired
false (default), trueNo

If secure-text="true", the input in the text field will be obscured. Appropriate to use for passwords or other sensitive information.

text-content-type (iOS)

TypeRequired
none (default), none, URL, addressCity, addressCityAndState, addressState, countryName, creditCardNumber, emailAddress, familyName, fullStreetAddress, givenName, jobTitle, location, middleName, name, namePrefix, nameSuffix, nickname, organizationName, postalCode, streetAddressLine1, streetAddressLine2, sublocality, telephoneNumber, username, password, newPassword, oneTimeCodeNo

The text-content-type autofills available fields (for example, for iOS 12+ oneTimeCode can be used to indicate that a field can be autofilled by a code arriving in an SMS).

allowFontScaling

TypeRequired
booleanNo

Specifies whether fonts should scale to respect Text Size accessibility setting

maxFontSizeMultiplier

TypeRequired
numberNo

Specifies whether fonts should scale to respect Text Size accessibility setting

minimumFontScale (iOS)

TypeRequired
numberNo

Specifies the smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).

← <form><select-single> →
  • Structure
  • Attributes
  • text-content-type (iOS)
Hyperview
Docs
ExamplesHyperview Reference
More
BlogGitHub
Copyright © 2025 Instawork