NativeScript Core

Html View

The HtmlView control represents a view with HTML content. Use this component when you want to show static HTML content. For more advanced scenarios and for dynamic content use WebView.


Creating a HtmlView in XML.

<HtmlView html="{{ htmlString }}"></HtmlView>

Creating a HtmlView element via code-behind files.

const HtmlView = require("tns-core-modules/ui/html-view").HtmlView;
const myHtmlView = new HtmlView();
myHtmlView.html = "<span><h1><font color=\"blue\">NativeScript HtmlView</font></h1></br><h3>This component accept simple HTML strings</h3></span>";

Note: The HtmlView component has limited styling capabilities. For more complex scenarios use the WebView component.

Improve this document

Demo Source

API Reference for the HtmlView Class

Native Component

Android iOS
android.widget.TextView UILabel