One HTML template Web and mobile
Build cross-platform Angular apps HTML first: plain elements, CSS flex and grid, Tailwind classes and Spartan components. The browser renders them on the web, and MasonKit draws the same template as real native views on iOS and Android.
Built on
- Angular 22
- AnalogJS
- NativeScript
- MasonKit
- Spartan
- Tailwind CSS
Revenue is up 12% on last week
<section hlmCard class="w-full max-w-sm">
<div hlmCardHeader>
<div hlmCardTitle>Weekly report</div>
<p hlmCardDescription>Revenue is up 12% on last week</p>
</div>
<div hlmCardContent class="flex items-center gap-3">
<hlm-switch #alerts aria-label="Alerts" />
<span class="text-sm">
Alerts {{ alerts.checked() ? 'on' : 'off' }}
</span>
</div>
<div hlmCardFooter class="flex gap-2">
<button hlmBtn>Open report</button>
<button hlmBtn variant="outline">Share</button>
</div>
</section>How it works
Write it once, render it twice
A page is an Angular template made of ordinary elements. Each app turns it into its own platform's views, so web and native share the template and keep their own core.
Your template
div, p, ul, flex and grid, Tailwind classes and helm attributes. Shared templates live in packages/shared.
In the browser
AnalogJS and Vite render the template with the browser’s own elements. Pages are prerendered to static HTML, like this site.
- AnalogJS
- Vite
- Prerendered
On the device
MasonKit turns each element into a native view, not a web view. Mason, a Rust layout engine built on taffy, lays them out with flex, grid and block flow.
- NativeScript
- MasonKit
- iOS
- Android
Examples
Real screens from one codebase
Twelve example screens live in packages/shared. Each is one Angular component made of HTML, Tailwind and helm, with its own palette. They are running below in your browser, and the native app opens the same components on the device.
What you get
Everything in one workspace
The web home page and the native app read these from the same file in packages/shared.
Where it runs
Web
AnalogJS in the browser, prerendered to static HTML. This site is the web app.
iOS and Android
NativeScript with MasonKit: real native views, with these docs and their live demos on the device.
Up and running
Clone the workspace, then install and start an app. Native needs the NativeScript CLI, plus the Android SDK or Xcode.
npm install
npx nx serve web # the docs site
npx nx run native:android # the Android app
cd apps/native && ns run ios # the iOS app, on a Mac