Getting started
Introduction
nativescript-unified is an Nx monorepo for building NativeScript Angular apps the HTML-first way. You write pages as ordinary HTML (<div>, <p>, <h1>, <ul>, <a href>), lay them out with CSS flex and grid, style them with Tailwind classes, and build richer UI from Spartan helm components. The same template runs in two places:
- In a browser, through an AnalogJS app built with Vite. This site is that app.
- On a device, as real native views. MasonKit registers HTML-shaped elements with
@nativescript/angular. Each one is a native view, not a web view, and Mason, a Rust layout engine built on taffy, lays them out with CSS flex, grid and block flow.
Plain elements, flex, Tailwind and a helm card.
<section hlmCard class="max-w-md">
<div hlmCardHeader>
<div hlmCardTitle>HTML first</div>
<p hlmCardDescription>Plain elements, flex, Tailwind and a helm card.</p>
</div>
<div hlmCardContent class="flex flex-row items-center gap-2">
<button hlmBtn>Primary</button>
<button hlmBtn variant="outline">Outline</button>
<span hlmBadge variant="secondary">Spartan</span>
</div>
</section>Every live demo in these docs is the code shown in its Code tab, compiled at run time against the components in this workspace: in your browser on the web, and on the device in the native app. Nothing is mocked.
How the pieces fit
Web and native diverge often, so they are separate apps at the top of the workspace. Each owns its own pages and its own core (providers, bootstrap, platform setup). Everything both can use lives underneath:
| Layer | Where | What it holds |
|---|---|---|
| Web | apps/web | AnalogJS app: pages/, web providers |
| Native | apps/native | NativeScript Angular app: pages/, native bootstrap |
| Shared | packages/shared | HTML-first components, example screens and the Markdown for these docs |
| UI | packages/ui | Spartan brain (headless) and helm (styled) components, the theme tokens and the NativeScript glue |
Project structure has the full map, and Web vs native explains how to decide where code goes.
Where to start
- Installation: install the workspace and run both apps.
- Project structure and Web vs native: what lives where.
- HTML first, then Layout with flex and grid and Theming: how pages are written.
- Components: live Spartan helm examples, and what each one does on native.
- File-based routing and Markdown content on native: pages and content on both platforms.
Short answers to common questions are in the FAQ.
NativeScript views
NativeScript apps are often written with tags such as <StackLayout> and <Label>. The web-polyfills package implements those tags as Angular components so an existing NativeScript tree also renders in a browser. New pages are HTML first, and the tags have their own section: NativeScript views.
Platforms
The targets are the web, iOS and Android.
The web app builds and prerenders this site. The native app renders these same docs pages with their live demos on the device. Native status records what each component does there, and the limits that apply to every component are in Known native limitations.