NativeScript-Vue 2.0: Back to the Vueture (Webinar) is now on YouTube
TextView

This is an overview of the most common usage of TextView. For more information about the available properties, methods, or events, head over to the complete API documentation for TextView.

<TextView> is a UI component that shows an editable or a read-only multi-line text container. You can use it to let users type large text in your app or to show longer, multi-line text on the screen.

<TextView> extends TextBase and EditableTextBase which provide additional properties and events.


<TextView text="Multi\nLine\nText" />

<TextView> provides two-way data binding using v-model.

<TextView v-model="textViewValue" />

Displaying multi-style text

To apply multiple styles to the text in your <TextView>, you can use <FormattedString>

<TextView editable="false">
  <FormattedString>
    <Span text="You can use text attributes such as " />
    <Span text="bold, " fontWeight="Bold" />
    <Span text="italic " fontStyle="Italic" />
    <Span text="and " />
    <Span text="underline." textDecoration="Underline" />
  </FormattedString>
</TextView>

Props

NameTypeDescription
textStringGets or sets the value of the component.
hintStringGets or sets the placeholder text when the component is editable.
editableBooleanWhen true, indicates that the user can edit the contents of the container.
maxLengthNumberSets the maximum number of characters that can be entered in the container.
keyboardTypeKeyboardTypeShows a custom keyboard for easier text input.
Valid values: datetime, phone, number, url, or email.
returnKeyTypeGets or sets the label of the return key. Currently supported only on iOS.
Valid values: done, next, go, search, or send.
autocorrectBooleanEnables or disables autocorrect.

Events

NameDescription
textChangeEmitted when the text changes.
returnPressEmitted when the return key is pressed.
focusEmitted when the container is in focus.
blurEmitted when the container loses focus.

Native component

AndroidiOS
android.widget.EditTextUITextView
Contributors