Preview 2.0 is now in Public Beta!
Read the Announcement
Note: You are on the beta version of our docs. This is a work in progress and may contain broken links and pages.

<HtmlView> is a UI component that lets you show static HTML content.

See also: WebView.


xml
<HtmlView loaded="onHtmlLoaded" />
ts
import { HtmlView } from '@nativescript/core'

export function onHtmlLoaded(args) {
  const myHtmlView = args.object as HtmlView
  myHtmlView.html = `<span>
        <h1><font color=\"blue\">NativeScript HtmlView</font></h1></br>
        <h3>This component accept simple HTML strings</h3></span>`
}

Props

html

xml
<HtmlView html="{{ html }}" />
ts
export class HelloWorldModel extends Observable {
  html = `<span>
  <h1><font color=\"blue\">NativeScript HtmlView</font></h1></br>
  <h3>This component accept simple HTML strings</h3></span>`
}

The HTML content to be shown.


selectable

xml
<HtmlView html="{{ html }}" selectable="false"/>
ts
htmlView.selectable = false

Gets or sets a value indicating whether HtmlView is selectable.


Inherited

For additional inherited properties, refer to the API Reference.

Native component

AndroidiOS
android.widget.TextViewUITextView
Previous
DatePicker
Next
Image