Skip to content
NativeScript Unified

NativeScript views

NativeScript views

Why they exist

NativeScript apps are often written with tags such as <StackLayout>, <GridLayout> and <Label>. The web-polyfills package implements those tags as Angular components whose selector is the tag name. If you import them, an existing tree renders on the web without being rewritten:

The code shown with every demo is the code that runs, compiled in your browser against the real polyfill components.

When to use them

  • You are moving an existing NativeScript app to the web and want it to render before you rewrite it.
  • You are keeping a shared template that uses NativeScript tags.

Otherwise, use plain HTML. Each page in this section ends with an HTML-first equivalent, and the table on HTML first lists them all.

What is in this section

SplitView and Navigation views have polyfills too. Their pages are under App structure, because apps build their screens around them.

Not custom elements

The polyfills are Angular components that you import where you use them. They are not registered as DOM custom elements, because a custom element name must contain a hyphen and StackLayout does not.

Web only

Native never imports web-polyfills. On a device those tags are real NativeScript views.