Skip to content
NativeScript Unified

HTML first

HTML first

HTML first means new UI is plain HTML. A page is a template made of ordinary elements. Layout is CSS flex and grid, styling is Tailwind classes that read the shared theme tokens, and richer pieces are Spartan helm components.

One template

Plain elements, Tailwind classes and a helm card.

HTMLTailwindSpartan

The four layers

  1. Elements. div, p, h1 to h6, ul, li, a, span, img, button. On the web they are the browser's own. On a device, MasonKit registers native elements under the same tag names with @nativescript/angular.
  2. Layout. CSS flex and grid. See Layout with flex and grid.
  3. Styling. Tailwind utility classes using token names such as bg-background, text-foreground and bg-primary text-primary-foreground. See Theming.
  4. Components. Spartan helm, as attributes and small components. See Components.

Which tag for which job

If you are coming from NativeScript tags, this is the HTML-first replacement for each one. The links go to each tag's page, which shows the same mapping with a live example.

NativeScript tagHTML first
StackLayoutdiv with flex flex-col or flex flex-row
GridLayoutdiv with grid, grid-cols-* and grid-rows-*
FlexboxLayoutdiv with flex and the justify, items and order classes
WrapLayoutdiv with flex flex-wrap
DockLayouta grid with an auto 1fr auto template
AbsoluteLayoutrelative container with absolute children
Label, FormattedString, Spanp, span, strong, em
Imageimg
ScrollViewdiv with overflow-auto on the web, <scroll> in the native example app
ListView, Repeater@for over ul and li
Button, TextFieldbutton hlmBtn, input hlmInput

Shared between web and native

Pages that use only plain elements, token classes and helm can live in packages/shared and render in both apps. See Writing shared HTML features. Anything that needs a platform API stays in apps/web or apps/native. See Web vs native.