The HtmlView
represents a view with HTML content.
Use this component instead of a WebView
when you
want to show static HTML content with base HTML support.
<HtmlView html="{{ htmlString }}"></HtmlView>
const HtmlView = require("tns-core-modules/ui/html-view").HtmlView;
function createHtmlView() {
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>";
return myHtmlView;
}
import { HtmlView } from "tns-core-modules/ui/html-view";
function createHtmlView() {
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>`;
return myHtmlView;
}
Note: The HtmlView
component has limited styling
capabilities. For more complex scenarios use the
WebView
component.
Name |
Type |
Description |
html |
string |
Gets or sets the HTML string. Limited HTML support - for
extended support use WebView
|
Name |
Description |
layoutChangedEvent |
String value used when hooking to layoutChanged event.
|
loaded |
String value used when hooking to loaded event. |